diff options
-rw-r--r-- | net/tcpserver.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/net/tcpserver.c b/net/tcpserver.c index 79fba19..48f55a1 100644 --- a/net/tcpserver.c +++ b/net/tcpserver.c @@ -402,7 +402,7 @@ static size_t tcpserver_send_buf(int client, int sockfd, char *byte_buf, size_t } if (FD_ISSET(sockfd, &wfds)) { - result = send(sockfd, byte_buf, (int)(length-sent), 0); + result = send(sockfd, bp, 1, 0);/*(sockfd, bp, (int)(length-sent), 0);*/ if (result <= 0) { sys_sockerror("tcpserver: send"); @@ -591,11 +591,11 @@ static int tcpserver_get_socket_send_buf_size(int sockfd) int optVal = 0; int optLen = sizeof(int); #ifdef MSW - if (getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (char*)&optVal, &optLen) == SOCKET_ERROR)
- post("%_get_socket_send_buf_size: getsockopt returned %d\n", objName, WSAGetLastError());
+ if (getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (char*)&optVal, &optLen) == SOCKET_ERROR) + post("%_get_socket_send_buf_size: getsockopt returned %d\n", objName, WSAGetLastError()); #else - if (getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (char*)&optVal, &optLen) == -1)
- post("%_get_socket_send_buf_size: getsockopt returned %d\n", objName, errno);
+ if (getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (char*)&optVal, &optLen) == -1) + post("%_get_socket_send_buf_size: getsockopt returned %d\n", objName, errno); #endif return optVal; } @@ -606,11 +606,11 @@ static int tcpserver_set_socket_send_buf_size(int sockfd, int size) int optVal = size; int optLen = sizeof(int); #ifdef MSW - if (setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (char*)&optVal, optLen) == SOCKET_ERROR)
- post("%s_set_socket_send_buf_size: setsockopt returned %d\n", objName, WSAGetLastError());
+ if (setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (char*)&optVal, optLen) == SOCKET_ERROR) + post("%s_set_socket_send_buf_size: setsockopt returned %d\n", objName, WSAGetLastError()); #else - if (setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (char*)&optVal, optLen) == -1)
- post("%s_set_socket_send_buf_size: setsockopt returned %d\n", objName, errno);
+ if (setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (char*)&optVal, optLen) == -1) + post("%s_set_socket_send_buf_size: setsockopt returned %d\n", objName, errno); #endif else return (tcpserver_get_socket_send_buf_size(sockfd)); } @@ -735,21 +735,21 @@ static void tcpserver_connectpoll(t_tcpserver *x) post("%s: accepted connection from %s on socket %d", objName, x->x_host[i]->s_name, x->x_fd[i]); /* see how big the send buffer is on this socket */ - x->x_fdbuf[i] = 0;
-#ifdef MSW
- if (getsockopt(x->x_fd[i], SOL_SOCKET, SO_SNDBUF, (char*)&optVal, &optLen) != SOCKET_ERROR)
- {
- /* post("%s_connectpoll: send buffer is %ld\n", objName, optVal); */
- x->x_fdbuf[i] = optVal;
- }
- else post("%s_connectpoll: getsockopt returned %d\n", objName, WSAGetLastError());
+ x->x_fdbuf[i] = 0; +#ifdef MSW + if (getsockopt(x->x_fd[i], SOL_SOCKET, SO_SNDBUF, (char*)&optVal, &optLen) != SOCKET_ERROR) + { + /* post("%s_connectpoll: send buffer is %ld\n", objName, optVal); */ + x->x_fdbuf[i] = optVal; + } + else post("%s_connectpoll: getsockopt returned %d\n", objName, WSAGetLastError()); #else - if (getsockopt(x->x_fd[i], SOL_SOCKET, SO_SNDBUF, (char*)&optVal, &optLen) == 0)
- {
- /* post("%s_connectpoll: send buffer is %ld\n", objName, optVal); */
- x->x_fdbuf[i] = optVal;
- }
- else post("%s_connectpoll: getsockopt returned %d\n", objName, errno);
+ if (getsockopt(x->x_fd[i], SOL_SOCKET, SO_SNDBUF, (char*)&optVal, &optLen) == 0) + { + /* post("%s_connectpoll: send buffer is %ld\n", objName, optVal); */ + x->x_fdbuf[i] = optVal; + } + else post("%s_connectpoll: getsockopt returned %d\n", objName, errno); #endif outlet_float(x->x_connectout, x->x_nconnections); outlet_float(x->x_sockout, x->x_fd[i]); /* the socket number */ |