Jean-Louis CHARTON wrote: > But in my opinion, to illustrate the right use of libssh2 functions > in non blocking mode, I think each call to a libssh2 function that > may block should be followed by a test for EAGAIN. After all, this > is the right way to proceed with non blocking IO in general; not > just with libssh2.
Well.. > I mean that for example just do a: > rc = libssh2_session_startup(...) > if (rc) { > exit some_error; > } > > is a pretty poor illustration of how to use libssh2 library in that > case Yes and no. I think it does show many things, but I totally agree with you that it is not near a full application which uses libssh2 in non-blocking mode. Maybe a full application like that will not really be "simple" ? On the other hand, maybe it can still be "simple" ? :) > because you can be pretty sure that most of the time rc will > be EAGAIN and so most of the time, the sample program is going > to fail. I see it more as a demonstration of the minimum neccessary to compile and link. A known good starting point where I can get going with using the library. > If EAGAIN is not handled correctly in the non blocking examples; > then why make a difference between blocking and non blocking > examples? Maybe because every app will want to handle EAGAIN in different ways? Or the examples just need to be improved. Even if you don't have time to do it yourself, maybe you have ideas about how it could be done? Maybe an idea for a slightly less simple example but something that does make good use of the nonblockingness? //Peter ------------------------------------------------------------------------------ _______________________________________________ libssh2-devel mailing list libssh2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libssh2-devel