Advertisement

WSAAccept is always blocking

Started by May 17, 2005 12:13 AM
0 comments, last by nevernomore 19 years, 9 months ago
Hi there, I am writing on a TCP class and noticed that even though my stream socket is created with the "Overlapped" option, it blocks when calling WSAAccept. I read the documentation over and over again and put together the following stuff: - WSAEWOULDBLOCK The socket is marked as nonblocking and no connections are present to be accepted. (That is what I expected in the first place) - A socket in nonblocking mode (blocking) fails with the error WSAEWOULDBLOCK when an application calls WSAAccept and no connections are pending on the queue. (Why does it say nonblocking and then blocking ?) - WSA_FLAG_OVERLAPPED This flag causes an overlapped socket to be created. Overlapped sockets can utilize WSASend, WSASendTo, WSARecv, WSARecvFrom, and WSAIoctl (But no WSAAccept ???) Maybe someone can give me some feedback on this. Thanks alot. Lorenz
WSA_FLAG_OVERLAPPED refers to overlapped I/O. Only functions that take a WSAOVERLAPPED* parameter can do overlapped I/O.

The overlapped property of a socket is orthogonal to the blocking/non-blocking nature.

Look at AcceptEx, or use ioctlsocket to set it to non-blocking.

This topic is closed to new replies.

Advertisement