aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utils.c')
-rw-r--r--src/Utils.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Utils.c b/src/Utils.c
index 62e95c7..4aee4c0 100644
--- a/src/Utils.c
+++ b/src/Utils.c
@@ -23,6 +23,8 @@
#include <netdb.h>
#include <sys/errno.h>
#include <arpa/inet.h>
+#include <fcntl.h>
+#include <unistd.h>
#include "SocketUtils.h"
@@ -409,3 +411,16 @@ int Socket_TCPBlockingRead(int fd,char *buffer, int buflen)
return accum;
}
}
+
+int Socket_SetNonBlocking(int sock)
+{
+ int retval,ierr;
+ ierr = fcntl (sock, F_SETFL, O_NONBLOCK);
+
+ if (ierr<0)
+ retval = -1;
+ else
+ retval = 0;
+
+ return(retval);
+}