From 9b0370eae096fd6ce7fdb375e074d659ea18fc25 Mon Sep 17 00:00:00 2001 From: gambas Date: Sat, 30 Sep 2017 19:27:40 +0200 Subject: [PATCH] Socket: Don't try to read just the available data. Just read what the users wants, and return the data actually read. [GB.NET] * BUG: Socket: Don't try to read just the available data. Just read what the users wants, and return the data actually read. --- gb.net/src/CSocket.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gb.net/src/CSocket.c b/gb.net/src/CSocket.c index 091b5369c..ee178d067 100644 --- a/gb.net/src/CSocket.c +++ b/gb.net/src/CSocket.c @@ -435,18 +435,18 @@ int CSocket_stream_read(GB_STREAM *stream, char *buffer, int len) { void *_object = stream->tag; int npos=-1; - int bytes; + //int bytes; if (!THIS) return -1; - if (ioctl(SOCKET->socket,FIONREAD,&bytes)) + /*if (ioctl(SOCKET->socket,FIONREAD,&bytes)) { CSocket_stream_internal_error(THIS, NET_CANNOT_READ, FALSE); return -1; } //if (bytes < len) return -1; if (bytes < len) - len = bytes; + len = bytes;*/ USE_MSG_NOSIGNAL(npos = recv(SOCKET->socket,(void*)buffer,len*sizeof(char),MSG_NOSIGNAL));