diff options
Diffstat (limited to 'src/net_unix/udp.c')
| -rw-r--r-- | src/net_unix/udp.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/net_unix/udp.c b/src/net_unix/udp.c index a701d48..79df4b0 100644 --- a/src/net_unix/udp.c +++ b/src/net_unix/udp.c @@ -12,6 +12,7 @@ #include <netdb.h> #include <string.h> #include <assert.h> +#include <fcntl.h> #define BUFSIZE 1000 @@ -149,6 +150,20 @@ sock_udp_t* connectUdpSocket(char *address, int port, int proto) return new; } +int setUdpSockNonBlock(sock_udp_t *p) +{ + int oldFlag; + + oldFlag = fcntl (p->sock, F_GETFL, 0); + + if( fcntl(p->sock, F_SETFL, oldFlag|O_NONBLOCK ) == -1 ) + { + return -1; + } + + return 0; +} + int readUdpSocket(sock_udp_t *src, sock_udp_t *dst, void *address, int len) { int addrlen; |