diff options
author | lanfer <lanfer@9697cf00-7f2a-4e1b-af3c-314b8e4b499e> | 2000-06-15 12:29:49 +0000 |
---|---|---|
committer | lanfer <lanfer@9697cf00-7f2a-4e1b-af3c-314b8e4b499e> | 2000-06-15 12:29:49 +0000 |
commit | 3303c6bc1618b45467005a31a46f0cbd67b772e4 (patch) | |
tree | 33a97b5c4d80d7de13011fd7e003db22bfdc088c /src/Utils.c | |
parent | 739e22c8482adcf9421dd01217e865caed4c5be9 (diff) |
adding routine to set socket connection to non-blocking
git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/Socket/trunk@6 9697cf00-7f2a-4e1b-af3c-314b8e4b499e
Diffstat (limited to 'src/Utils.c')
-rw-r--r-- | src/Utils.c | 15 |
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); +} |