diff --git a/ChangeLog.txt b/ChangeLog.txt index 68cbc93671..fb5e02f083 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,12 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2018-02-11 11:00 UTC+0100 Aleksander Czajczynski (hb fki.pl) + * contrib/hbnetio/netiocli.c + ! fix spontaneous Error 1003 in NETIO client code failing to receive + full length of incoming data packet. Such odd behaviour was spotted + on Windows. + 2018-01-05 15:38 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/compiler/complex.c * pacified warning and removed commented debug code I committed by mistake diff --git a/contrib/hbnetio/netiocli.c b/contrib/hbnetio/netiocli.c index 84e56dff4c..8b0fdb554c 100644 --- a/contrib/hbnetio/netiocli.c +++ b/contrib/hbnetio/netiocli.c @@ -85,6 +85,7 @@ #include "hbvm.h" #include "hbstack.h" #include "hbthread.h" +#include "hbdate.h" #include "netio.h" #include "hbserial.ch" @@ -186,13 +187,20 @@ static long s_fileRecvAll( PHB_CONCLI conn, void * buffer, long len ) { HB_BYTE * ptr = ( HB_BYTE * ) buffer; long lRead = 0, l; + HB_MAXINT timeout = conn->timeout; + HB_MAXUINT timer = hb_timerInit( timeout ); while( lRead < len ) { - l = hb_sockexRead( conn->sock, ptr + lRead, len - lRead, conn->timeout ); - if( l <= 0 ) - break; - lRead += l; + l = hb_sockexRead( conn->sock, ptr + lRead, len - lRead, 1000 ); + if( l > 0 ) + lRead += l; + + else if( l == 0 || + hb_socketGetError() != HB_SOCKET_ERR_TIMEOUT || + ( timeout = hb_timerTest( timeout, &timer ) ) == 0 || + hb_vmRequestQuery() != 0 ) + break; } return lRead; }