Check socket lock (depends on Winsock)

Possible duplicate:
In Win32, is there a way to check if a socket is non-blocking?

This is how I set the socket to non-blocking mode in windows.

  unsigned long mode = is_blocking?  0-1
 int ret = :: ioctlsocket (m_Socket, FIONBIO, & mode); 


In my complex library, I get random locks because some of the sockets passed to it were not set to non-blocking mode. Therefore, I would like to add and approve to find out where the non-blocking socket is coming from. The problem is that I have no idea how to check if the socket is blocked.



On unix, it's simple:

  long arg = 0;
 if ((arg = fcntl (m_Socket, F_GETFL, NULL)) <0) { 
    return ERROR;
 }
 bool was_blocking = (arg & O_NONBLOCK)! = 0;



therefore, how can I check if a socket is blocking windows.

thanks

+4
source share
1 answer

Windows does not offer any way to request whether the socket is currently set to block or not block.

+5
source

All Articles