Hi, I am using WSAEventSelect for notification of socket events. So far, everything is cool and works like a charm, but there is one problem.
The client is a .NET application, and the server is written in Winsock C ++. In a .NET application, I use the System.Net.Sockets.Socket class for TCP / IP. When I call the Socket.Shutdown () and Socket.Close () method, I get the FD_CLOSE event on the server, and I'm sure everything is fine. Well, the problem occurs when I check the iErrorCode WSANETWORKEVENTS, which I passed to WSAEnumNetworkEvents. I check it like
if (listenerNetworkEvents.lNetworkEvents & FD_CLOSE) { if (listenerNetworkEvents.iErrorCode[FD_CLOSE_BIT] != 0) { // it comes here // which means there is an error // and the ERROR I got is // WSAECONNABORTED printf("FD_CLOSE failed with error %d\n", listenerNetworkEvents.iErrorCode[FD_CLOSE_BIT]); break; } closesocket(socketArray[Index]); }
But it fails with the WSAECONNABORTED error. Why is this so?
EDIT: By the way, am I running both the client and the server on the same computer, because of this? And I got the FD_CLOSE event when I do this:
server.Shutdown(SocketShutdown.Both); // in .NET C
source share