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.
This commit is contained in:
gambas 2017-09-30 19:27:40 +02:00
parent 5bf2fad9f6
commit 9b0370eae0

View file

@ -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));