Jump to content
  • Advertisement
Sign in to follow this  

Asynchronous TCP server doesn't trigger FD_READ

This topic is 2976 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all. First of all saying, for learning purposes, Im trying to create a chat with asynchronous tcp sockets in both sides client and server. Everything goes fine but I have found this strange problem: my server doesn't trigger FD_READ but only when the socket is in the connection process. Accept and close work fine. Im using Wireshark to test the network transfers and everything is right. The client is sending the package (a text) to the server, and even the server returns with another packet but the FD_READ isn't triggered :(. I have also tested with other "clients" socket based where my server accept them but after sending packets to server, FD_READ never appears but only at start when socket is connecting. Maybe it's something simple like doing opposite to shutdown when connection is established? :). I post here relevant pieces of code: //SERVER SOCKET CREATION: WSAAsyncSelect (ServerSocket,my_handle,WM_SOCKET,(FD_READ | FD_WRITE | FD_ACCEPT | FD_CLOSE)) //ACCEPT FUNCTION: WSAAccept(ServerSocket, (struct sockaddr *) &NewClientAddr, &sin_size, &ConditionAcceptFunc, NULL) // CONDITIONAL FUNCTION TO ACCEPT CONNECTIONS: int CALLBACK ConditionAcceptFunc( LPWSABUF lpCallerId, LPWSABUF lpCallerData, LPQOS pQos, LPQOS lpGQOS, LPWSABUF lpCalleeId, LPWSABUF lpCalleeData, GROUP FAR * g, DWORD_PTR dwCallbackData ) { if (ClientSocketsCount < (MAX_CLIENTS-1)){ ClientSocketsCount++; return CF_ACCEPT; }else return CF_REJECT; }

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!