|
|
刚刚接触Socket编程,想请教下:
我用TCP阻塞,目的是用recv接收一个完整的struct,recv设置MSG_WAITALL之后,总是立即返回SOCKET_ERROR,WSAGetLastError()返回WSAEOPNOTSUPP。
MSDN文档说
MSG_WAITALL The receive request will complete only when one of the following events occurs:
A. The buffer supplied by the caller is completely full.
B. The connection has been closed.
C. The request has been canceled or an error occurred.
Note that if the underlying transport does not support MSG_WAITALL, or if the socket is in a non-blocking mode, then this call will fail with WSAEOPNOTSUPP. Also, if MSG_WAITALL is specified along with MSG_OOB, MSG_PEEK, or MSG_PARTIAL, then this call will fail with WSAEOPNOTSUPP. This flag is not supported on datagram sockets or message-oriented CO sockets.
是不是这个原因:“Note that if the underlying transport does not support MSG_WAITALL,”? |
|