On Fri, 09 Oct 2009, Grigory Filatov wrote: Hi,
> 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); I know but it's the standard definition in all BSD * socket implementations though POSIX standard suggest to use as last two parameters: const void *optval, socklen_t optlen anyhow it does not inform what is the internal structure of value pointed by optval. Different options use different parameters. You have to check in the documentation expected value for each socket option you are using and pass as parameter valid structure, i.e. here is Linux documentation for SO_RCVTIMEO and SO_SNDTIMEO which is semantically compatible with original BSD documentation: SO_RCVTIMEO and SO_SNDTIMEO Specify the receiving or sending timeouts until reporting an error. The parameter is a struct timeval. If an input or out‐ put function blocks for this period of time, and data has been sent or received, the return value of that function will be the amount of data transferred; if no data has been transferred and the timeout has been reached then -1 is returned with errno set to EAGAIN or EWOULDBLOCK just as if the socket was specified to be non-blocking. If the timeout is set to zero (the default) then the operation will never timeout. Timeouts only have effect for system calls that perform socket I/O (e.g., read(2), recvmsg(2), send(2), sendmsg(2)); timeouts have no effect for select(2), poll(2), epoll_wait(2), etc. As long as you do not know any MS-Windows socket documentations which explicitly says that WINSOCK uses different structure as SOL_SOCKET-> SO_RCVTIMEO parameter then I strongly suggest to use original BSD socket documentation and in this case modify the code to use pointer to 'struct timeval' instead of pointer to 'int' as parameter for setsockopt( sd, SOL_SOCKET, SO_RCVTIMEO, ... ). best regards, Przemek _______________________________________________ Harbour mailing list Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour