diff --git a/telnet.c b/telnet.c index e3f8290..e98fa2e 100644 --- a/telnet.c +++ b/telnet.c @@ -37,6 +37,11 @@ * the given IBM host. */ +#if defined(_WIN32) + #include + #include +#endif + #include #if defined(HAVE_LIBSSL) #include @@ -47,7 +52,6 @@ #include #if defined(_WIN32) - #include #include #else #include @@ -3163,6 +3167,18 @@ net_snap_options(void) */ static int non_blocking(H3270 *session, Boolean on) { +# if defined(FIONBIO) + + int i = on ? 1 : 0; + + if (SOCK_IOCTL(session->sock, FIONBIO, (int *) &i) < 0) + { + popup_a_sockerr(session, N_( "ioctl(%s)" ), "FIONBIO"); + return -1; + } + +#else + int f; if ((f = fcntl(session->sock, F_GETFL, 0)) == -1) @@ -3182,6 +3198,8 @@ static int non_blocking(H3270 *session, Boolean on) return -1; } +#endif // FIONBIO + return 0; } -- libgit2 0.21.2