Blocking and Non-Blocking mode in the same program - WeOnlyDo Discussion board

Blocking and Non-Blocking mode in the same program (wodSSH / wodSSH.NET)

by zubenelgenubi, Tuesday, August 24, 2010, 14:58 (4965 days ago)

Hi,

We have a program that we are developing for managing network connectivity on Cisco devices. For some time we have been using SSH.Net to connect to devices in 'Non-blocking' mode. Our program reads data in the DataReceived event.

We want to add another feature to the same program. This time we want to use the SSH.Net component in 'Blocking' mode. During testing we are receiving a error in the DataReceived event. The error is thrown at teh following line:

s = Ssh1.Receive();

The error is: Timeout occurred due to inactivity.

So, the question is: Is it possible to use the SSH.Net component in both blocking and non-blocking mode from within the same program? What has to happen in order to allow this to work reliably?

TIA

Re: Blocking and Non-Blocking mode in the same pro

by wodDamir, Tuesday, August 24, 2010, 15:02 (4965 days ago) @ zubenelgenubi

Hi,

The answer would be No. The component can't use both modes, since calling blocking methods in events would most probably cause an unexpected behaviour, such as a Hang or similiar.

In other words, Events shouldn't be used in Blocking mode.

Hope this helps.

Regards,
Damba

Re: Blocking and Non-Blocking mode in the same pro

by zubenelgenubi, Tuesday, August 24, 2010, 15:53 (4965 days ago) @ wodDamir

Hi,

Thanks for the speedy response.

Hi,

The answer would be No. The component can't use both modes, since calling blocking methods in events would most probably cause an unexpected behaviour, such as a Hang or similiar.

In other words, Events shouldn't be used in Blocking mode.

Hope this helps.

Regards,
Damba