Subject: RE : RE : About simple examples

RE : RE : About simple examples

From: Jean-Louis CHARTON <Jean-Louis.CHARTON_at_oikialog.com>
Date: Wed, 1 Apr 2009 20:28:58 +0200

-----Message d'origine-----
De : Peter Stuge [mailto:peter_at_stuge.se]
Envoyé : mercredi 1 avril 2009 19:21
À : libssh2-devel_at_lists.sourceforge.net
Objet : Re: RE : About simple examples

>
> I would treat the simple examples as just that - very
> simple examples of how to call the library.
>

Peter, I agree that simple examples should be there to illustrate in a very basic manner how to call the library functions. I also perfectly agree with you on the use of a select to avoid busywaiting (this is indeed the sense of the question I asked for in my first post in this thread. See "Other question").

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.

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 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.

If EAGAIN is not handled correctly in the non blocking examples; then why make a difference between blocking and non blocking examples?

JL

------------------------------------------------------------------------------
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2009-04-01