From: pk910 Date: Wed, 10 Aug 2011 00:19:28 +0000 (+0200) Subject: fixed a <> bug and added some debug output X-Git-Tag: v5.3~643 X-Git-Url: http://git.pk910.de/?a=commitdiff_plain;h=f371dec13df74466854101b59e0c851f5a3714f9;p=NeonServV5.git fixed a <> bug and added some debug output --- diff --git a/ClientSocket.c b/ClientSocket.c index fbbee33..f92d65a 100644 --- a/ClientSocket.c +++ b/ClientSocket.c @@ -139,6 +139,7 @@ void socket_loop(int timeout_seconds) { if(ret == 0) return; for (sock = sockets->data; sock; sock = sock->next) { if((sock->flags & SOCKET_FLAG_CONNECTED) && FD_ISSET(sock->sock, &fds)) { + printf("RECV FROM: %d", sock->sock); if(sock->bufferpos != 0) { bytes = read(sock->sock, buffer, sizeof(buffer)); if(bytes > 0) { @@ -150,10 +151,12 @@ void socket_loop(int timeout_seconds) { } } else { bytes = read(sock->sock, sock->buffer, sizeof(sock->buffer)); + sock->buffer[bytes] = 0; //debug only + printf("RECV %d: %s", bytes, sock->buffer); if(bytes > 0) sock->bufferpos = bytes; } - if(bytes >= 0) { + if(bytes <= 0) { //error sock->flags &= ~(SOCKET_FLAG_CONNECTED | SOCKET_FLAG_READY); } else {