diff options
author | Martin Peach <mrpeach@users.sourceforge.net> | 2009-02-23 20:58:50 +0000 |
---|---|---|
committer | Martin Peach <mrpeach@users.sourceforge.net> | 2009-02-23 20:58:50 +0000 |
commit | 05b6ae2680c633a96cfddd6226eb344a54eff7a4 (patch) | |
tree | de1b4754c563934c59de795d00e104f38e588669 | |
parent | fc18a719d4d76da4f1f3f4e78c15112e473127ef (diff) |
Fixed select call so it works properly
svn path=/trunk/externals/mrpeach/; revision=10810
-rw-r--r-- | net/tcpserver.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/tcpserver.c b/net/tcpserver.c index 595a08b..4b061d7 100644 --- a/net/tcpserver.c +++ b/net/tcpserver.c @@ -43,6 +43,7 @@ #include <stdlib.h> #include <sys/time.h> #include <errno.h> +#include <sys/select.h> #define SOCKET_ERROR -1 #else #include <winsock2.h> @@ -286,7 +287,7 @@ static void tcpserver_send_bytes(int client, t_tcpserver *x, int argc, t_atom *a unsigned char c; float f, e; int length; - size_t flen; + size_t flen = 0; int sockfd = x->x_fd[client]; char fpath[FILENAME_MAX]; FILE *fptr; @@ -382,7 +383,7 @@ static size_t tcpserver_send_buf(int client, int sockfd, char *byte_buf, size_t FD_SET(sockfd, &wfds); timeout.tv_sec = 1; /* give it one second to clear buffer */ timeout.tv_usec = 0; - result = select(1, NULL, &wfds, NULL, &timeout); + result = select(sockfd+1, NULL, &wfds, NULL, &timeout); if (result == -1) { post("%s_send_buf: select returned error %d", objName, errno); |