mirror of
https://github.com/libssh2/libssh2.git
synced 2025-08-29 08:01:59 +03:00
Carlo Bramini's fixes for the nonblocking examples for msys/mingw
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: sftpdir_nonblock.c,v 1.10 2007/08/09 01:10:11 dfandrich Exp $
|
||||
* $Id: sftpdir_nonblock.c,v 1.11 2008/09/30 08:55:35 bagder Exp $
|
||||
*
|
||||
* Sample doing an SFTP directory listing.
|
||||
*
|
||||
@@ -46,6 +46,9 @@ int main(int argc, char *argv[])
|
||||
const char *password="password";
|
||||
const char *sftppath="/tmp/secretdir";
|
||||
int rc;
|
||||
#if defined(HAVE_IOCTLSOCKET)
|
||||
long flag = 1;
|
||||
#endif
|
||||
LIBSSH2_SFTP *sftp_session;
|
||||
LIBSSH2_SFTP_HANDLE *sftp_handle;
|
||||
|
||||
@@ -91,6 +94,8 @@ int main(int argc, char *argv[])
|
||||
/* FIXME: this can/should be done in a more portable manner */
|
||||
rc = fcntl(sock, F_GETFL, 0);
|
||||
fcntl(sock, F_SETFL, rc | O_NONBLOCK);
|
||||
#elif defined(HAVE_IOCTLSOCKET)
|
||||
ioctlsocket(sock, FIONBIO, &flag);
|
||||
#else
|
||||
#error "add support for setting the socket non-blocking here"
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user