Zulfiqar Malik wrote:
> I am actually using libssh2_channel_write. I am basically just doing a cd
> <somedir> and then reading the output. The cd finishes and yet I am stuck
> in my loop since I never receive an EOF.
Seriously. You need to think about what is actually happening on the
Now, you do not say which kind of channel you have created, which is
absolutely neccessary information when you are asking about behavior
within a channel. However, since you start talking about shell I am
going to guess that you have created a shell channel.
If you start a shell *without* ssh and you run a cd command in that
shell does that shell close it's input and output channels? Obviously
it does not. That would be the most retarded shell ever.
Since you do not get an EOF when running the shell without ssh WHY
would get an EOF *with* SSH?
There is NO difference.
SSH provides an authenticated and encrypted transport to a server.
In this transport you can open various types of channels. Each
channel type may have completely different characteristics. If you
open a shell channel then it will behave EXACTLY like a shell running
Your program is talking to a shell, nothing more nothing less.
libssh2 is not an API for remote controlling shells. I wish that
people would understand this, there are countless posts to this
mailing list by people who do not understand this at all. We
desperately need to write a FAQ about it.
> I can use waitsocket. The Sleep is just test code. waitsocket
> doesn't imrpove the situation.
Seriously. There are several examples in the example/ directory
which demonstrate how you can correctly deal with multiple sources
of input in your program, which I believe is what you want to do
although you don't say it.
Please study those examples. In particular you want to study
direct_tcpip.c and tcpip-forward.c in detail.
Received on 2012-04-12