Hi Przemek, Thanks for your suggestion!
> someone can confirm that SOL_SOCKET->SO_RCVTIMEO uses 'int' as parameter > in MS-Windows. There is the following definition in the header file winsock.h from BCC: int PASCAL FAR setsockopt ( IN SOCKET s, IN int level, IN int optname, IN const char FAR * optval, IN int optlen); -- Kind Regards, Grigory Filatov Przemyslaw Czerpak-2 wrote: > > On Thu, 08 Oct 2009, Mitja Podgornik wrote: >> Hi, please, can anybody help? >> This function occasional causes GPF >> and occurs sporadic only on some xp/vista machines >> > >> Application Internal Error ... >> > >> Terminated at: .... >> > >> Info: Harbour MiniGUI 1.7 Extended Edition (Build 74) - 2009.09.30 >> > >> Unrecoverable error 9023: hb_xgrab requested to allocate zero bytes >> > >> Called from SOCKETRECEIVE(0) > > recv() on error returns -1 not 0. > >> nLen = recv( m_hSocket, pRead, nLen, 0 ); >> hb_storclen( pRead, nLen, 2 ); > ^^^^ > And in such case error appears here. > As short hackt o resolve the problem you can add hust after recv() > if( nLen < 0 ) nLen = 0; > This function can be also greatly optimized though it's maybe less > important. Anyhow I suggest to convert this code to use internally > hb_socket*() functions. This functions can create some other problems > changing socket options, i.e. as parameter for SOL_SOCKET->SO_RCVTIMEO > struct timeval (the same as in select()) should be used but this code > uses integer. I've never used it on Windows so it's possible it's a > bug in MS-Windows BSD socket implementation and it really needs int > value but I suggest to verify it. Please also note that it changes > socket parameters and then does not restore them so next calls will > use timeouts setting set by previous calls. Of course if they work > and someone can confirm that SOL_SOCKET->SO_RCVTIMEO uses 'int' as > parameter in MS-Windows. > > best regards, > Przemek > > -- View this message in context: http://www.nabble.com/hb_xgrab-requested-to-allocate-zero-bytes-tp25815411p25817794.html Sent from the Harbour - Dev mailing list archive at Nabble.com. _______________________________________________ Harbour mailing list Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour