{
#undef SETBLOCK
#ifdef HAVE_O_NONBLOCK
+ /* most recent unix versions */
int flags;
flags = fcntl(socket, F_GETFL, 0);
#endif
#ifdef HAVE_FIONBIO
+ /* older unix versions */
int flags;
flags = nonblock;
#endif
#ifdef HAVE_IOCTLSOCKET
+ /* Windows? */
int flags;
flags = nonblock;
return ioctlsocket(socket, FIONBIO, &flags);
#endif
#ifdef HAVE_IOCTLSOCKET_CASE
+ /* presumably for Amiga */
return IoctlSocket(socket, FIONBIO, (long)nonblock);
#define SETBLOCK 4
#endif
+#ifdef HAVE_SO_NONBLOCK
+ /* BeOS */
+ long b = nonblock ? 1 : 0;
+ return setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
+#define SETBLOCK 5
+#endif
+
#ifdef HAVE_DISABLED_NONBLOCKING
return 0; /* returns success */
-#define SETBLOCK 5
+#define SETBLOCK 6
#endif
#ifndef SETBLOCK
{
int err = 0;
socklen_t errSize = sizeof(err);
-
+#ifdef SO_ERROR
if( -1 == getsockopt(sockfd, SOL_SOCKET, SO_ERROR,
(void *)&err, &errSize))
err = Curl_ourerrno();
-
+#endif
return err;
}