Problem:
- Call to send(), returns Winsock Error 10038 against socket handle
Illustration:
acceptedSocket = accept (server, (sockaddr *)&sin, &len);
- accept(), returns 0
- A new thread, is created for each connection
- send(), (in thread function) returns 10038
Illustration: – in thread function
//omitted SOCKET RemoteSocket = (SOCKET) client; //omitted send (RemoteSocket, stringToSpend, strlen(stringToSpend), 0)
Suggestions:
- Possible, race condition?
- Could use I/O completion ports, but not at this stage
Isn’t the problem in the line
You make
acceptedSocketthe result of the comparison, but you should store the actual socket returned from accept somehow:Although I’m a bit confused by the unbalanced parentheses in your post, so I may be wrong