Subject: Re: [libssh2] polling isn't working on linux

Re: [libssh2] polling isn't working on linux

From: Paul Thomas <thomaspu_at_gmail.com>
Date: Sat, 26 Jan 2008 11:48:40 -0500

Whats also really strange is that theres about a 50% chance that if
either polling method I use say that there is dataavailable, when I
try and read from the socket, there is no data to be read.

Is there some preferred method to poll libssh2 for activity? It
doesn't look like I can use a "select" function cause I imagine that
would interfere with the library.

Paul

On Jan 25, 2008 11:13 PM, Paul Thomas <thomaspu_at_gmail.com> wrote:
> Developers....I'm having library problems again, heres my problem.
>
> The same code that I have works quite well on windows. But running
> this same code on linux randomly returns 0 when their is in fact data
> on the socket. I'm using Qt4 and am using the QSocketNotifier class to
> tell me when there is data on the socket available. Then when theres
> data, I use the libssh2 library polling to try and see which channel
> has data. The socket is being created natively with each OS's
> respective socket creation method. I based my socket creation code off
> of your /libssh2/example/simple/ssh2.c code. The problem that I'm
> having is that the two main polling methods
>
> LIBSSH2_POLLFD pfd;
> pfd.type = LIBSSH2_POLLFD_CHANNEL;
> pfd.fd.channel = (*mp_channelList)[i]->pChannel; //pointer to a valid channel
> int result = libssh2_poll( &pfd, 1, 1);
> printf("Polling result: %d\n", result);
> result = libssh2_poll_channel_read((*mp_channelList)[i]->pChannel, 0);
> printf("Polling result: %d\n", result);
> result = libssh2_poll_channel_read((*mp_channelList)[i]->pChannel, 1);
> printf("Polling result: %d\n", result);
> //readDataFromChannel
>
> Now from the code above, I'm trying 3 different polling calls. And
> each time I run my app, the polling functions are randomly working and
> not working. Here's the results of me running a few connection tests:
>
> Polling result: 1
> Polling result: 1
> Polling result: 0
> -----------Next run --------------
> Polling result: 0
> Polling result: 1
> Polling result: 0
> -----------Next run --------------
> Polling result: 1
> Polling result: 1
> Polling result: 0
>
> The 3rd method doesn't ever seem to work. I'm really lost as to why
> its randomly crapping out like this.
>
> Any ideas?
> Paul
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2008-01-26