Mateusz Pilski wrote:
> > Can you help us help you and provide a full example that repeats this
> > problem?
>
> i post here mostly simplified working code with this error
Your code is horribly formatted. For your own sake and everyone
else's who might have to read it, it would be good if you clean
it up.
> the interesting part is only function mainloop().
Yes.
> while(1) /*main loop*/
> {
> libssh2_channel_flush_ex(channel,LIBSSH2_CHANNEL_FLUSH_ALL);
> /*reading*/
> for(i=0;i<BUFFSIZE;i++)schelout[i]=0;
> readlen=libssh2_channel_read(channel,schelout,HALFBUFFSIZE);
> if(readlen>0)
> {
> printf("%s",schelout);
> fflush(stdout);
> }
> /*writing*/
> c[0]=getch();
> c[1]='\0';
> if(c[0]!=-1)
> {
> libssh2_channel_write(channel,c,strlen(c));
> libssh2_channel_flush(channel);
> }
> if(libssh2_channel_eof(channel)==1)break;
> }
This code is incorrect. Look at example/direct_tcpip.c for the method
which you *must* use when you want to handle both a libssh2 channel
and some other communications channel. (stdin in your case)
I bet that if you press enter in this ssh client then you will get
some more "missing" data displayed on your screen.
//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-02-24