diff --git a/example/simple/scp_nonblock.c b/example/simple/scp_nonblock.c index 9df3b0c..58d1386 100644 --- a/example/simple/scp_nonblock.c +++ b/example/simple/scp_nonblock.c @@ -1,5 +1,5 @@ /* - * $Id: scp_nonblock.c,v 1.11 2007/09/24 12:15:45 bagder Exp $ + * $Id: scp_nonblock.c,v 1.12 2008/09/30 08:55:35 bagder Exp $ * * Sample showing how to do SCP transfers in a non-blocking manner. */ @@ -45,6 +45,9 @@ int main(int argc, char *argv[]) const char *scppath="/tmp/TEST"; struct stat fileinfo; int rc; +#if defined(HAVE_IOCTLSOCKET) + long flag = 1; +#endif off_t got=0; #ifdef WIN32 @@ -88,6 +91,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 diff --git a/example/simple/scp_write_nonblock.c b/example/simple/scp_write_nonblock.c index bbe7976..98fbbaf 100644 --- a/example/simple/scp_write_nonblock.c +++ b/example/simple/scp_write_nonblock.c @@ -1,5 +1,5 @@ /* - * $Id: scp_write_nonblock.c,v 1.7 2007/08/09 01:10:11 dfandrich Exp $ + * $Id: scp_write_nonblock.c,v 1.8 2008/09/30 08:55:35 bagder Exp $ * * Sample showing how to do a simple SCP transfer. */ @@ -47,6 +47,9 @@ int main(int argc, char *argv[]) const char *scppath="/tmp/TEST"; FILE *local; int rc; +#if defined(HAVE_IOCTLSOCKET) + long flag = 1; +#endif char mem[1024]; size_t nread; char *ptr; @@ -105,6 +108,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 diff --git a/example/simple/sftp_RW_nonblock.c b/example/simple/sftp_RW_nonblock.c index d4d03ab..1de11af 100644 --- a/example/simple/sftp_RW_nonblock.c +++ b/example/simple/sftp_RW_nonblock.c @@ -1,5 +1,5 @@ /* - * $Id: sftp_RW_nonblock.c,v 1.10 2007/08/09 01:10:11 dfandrich Exp $ + * $Id: sftp_RW_nonblock.c,v 1.11 2008/09/30 08:55:35 bagder Exp $ * * Sample showing how to do SFTP transfers in a non-blocking manner. * @@ -53,6 +53,9 @@ int main(int argc, char *argv[]) const char *sftppath="/tmp/TEST"; /* source path */ const char *dest="/tmp/TEST2"; /* destination path */ int rc; +#if defined(HAVE_IOCTLSOCKET) + long flag = 1; +#endif LIBSSH2_SFTP *sftp_session; LIBSSH2_SFTP_HANDLE *sftp_handle; FILE *tempstorage; @@ -87,6 +90,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 diff --git a/example/simple/sftp_mkdir_nonblock.c b/example/simple/sftp_mkdir_nonblock.c index c093f8b..93466c4 100644 --- a/example/simple/sftp_mkdir_nonblock.c +++ b/example/simple/sftp_mkdir_nonblock.c @@ -1,5 +1,5 @@ /* - * $Id: sftp_mkdir_nonblock.c,v 1.9 2007/08/09 01:10:11 dfandrich Exp $ + * $Id: sftp_mkdir_nonblock.c,v 1.10 2008/09/30 08:55:35 bagder Exp $ * * Sample showing how to do SFTP non-blocking mkdir. * @@ -46,6 +46,9 @@ int main(int argc, char *argv[]) const char *password="password"; const char *sftppath="/tmp/sftp_mkdir_nonblock"; int rc; +#if defined(HAVE_IOCTLSOCKET) + long flag = 1; +#endif LIBSSH2_SFTP *sftp_session; #ifdef WIN32 @@ -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 diff --git a/example/simple/sftp_nonblock.c b/example/simple/sftp_nonblock.c index a97a410..82e761a 100644 --- a/example/simple/sftp_nonblock.c +++ b/example/simple/sftp_nonblock.c @@ -1,5 +1,5 @@ /* - * $Id: sftp_nonblock.c,v 1.13 2007/08/09 01:10:11 dfandrich Exp $ + * $Id: sftp_nonblock.c,v 1.14 2008/09/30 08:55:35 bagder Exp $ * * Sample showing how to do SFTP non-blocking transfers. * @@ -49,6 +49,9 @@ int main(int argc, char *argv[]) const char *password="password"; const char *sftppath="/tmp/TEST"; int rc; +#if defined(HAVE_IOCTLSOCKET) + long flag = 1; +#endif LIBSSH2_SFTP *sftp_session; LIBSSH2_SFTP_HANDLE *sftp_handle; @@ -94,6 +97,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 diff --git a/example/simple/sftp_write_nonblock.c b/example/simple/sftp_write_nonblock.c index 5cba62d..85787a1 100644 --- a/example/simple/sftp_write_nonblock.c +++ b/example/simple/sftp_write_nonblock.c @@ -1,5 +1,5 @@ /* - * $Id: sftp_write_nonblock.c,v 1.10 2007/08/09 01:10:11 dfandrich Exp $ + * $Id: sftp_write_nonblock.c,v 1.11 2008/09/30 08:55:35 bagder Exp $ * * Sample showing how to do SFTP non-blocking write transfers. * @@ -47,6 +47,9 @@ int main(int argc, char *argv[]) const char *loclfile="sftp_write_nonblock.c"; const char *sftppath="/tmp/sftp_write_nonblock.c"; int rc; +#if defined(HAVE_IOCTLSOCKET) + long flag = 1; +#endif FILE *local; LIBSSH2_SFTP *sftp_session; LIBSSH2_SFTP_HANDLE *sftp_handle; @@ -106,6 +109,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 diff --git a/example/simple/sftpdir_nonblock.c b/example/simple/sftpdir_nonblock.c index e236227..ff3af63 100644 --- a/example/simple/sftpdir_nonblock.c +++ b/example/simple/sftpdir_nonblock.c @@ -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