Receive problem in SSH - WeOnlyDo Discussion board

Receive problem in SSH (wodSSH / wodSSH.NET)

by Jeff, Thursday, January 12, 2006, 21:59 (6687 days ago)

Hello, I am using version 2.3.7 of your component in a C++ project. When trying to communicate with a Windows SSH server I am running into problems with Receive() in blocking mode. After I send dir >> tmp.txt I wait for 5 seconds to make sure the command works (via Sleep()). I also verified it did work by examing the tmp.txt file on the server. If I then call DataReady() it returns 0 bytes, or if I call Peek() it returns an empty string. But I know data is waiting for me to read because immediately after that I call Receive() and it gets data from the server?!?! Any idea why these methods are not working as expected.

Also, I am finding my Received() event does not get fired until I actually make the call to Receive() - this is not very helpful to me.

Finally, I have experimented with calling SetTimeout(5) before calling Receive(), which throws an exception as expected if the server does not have anything to send me, but WODSSH disconnects me! I know the session is ok, it is just that the server is sitting there idle. Is there anyway to tell WODSSH not to disconnect, just signal a timeout?

I really need to use Receive() instead of WaitFor() or ReceiveLine() since I am getting byte arrays from the server.

I must be missing something fundamental here - why does the Receive() model not seem to work?

What I need is for Receive() to support a model where I need to read a variable amount of data from the server, where the only way I know the server is done sending is when I do not receive any data for about 5 seconds or so.

I also tried Receive() in non-blocking mode, but it never returns any data.


Complete thread: