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.
This commit is contained in:
Aleksander Czajczynski
2018-02-11 11:00:15 +01:00
parent 6a0c6b1910
commit 9f016a6e2c
2 changed files with 18 additions and 4 deletions

View File

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

View File

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