Sign in to follow this  

Asynchronous TCP server doesn't trigger FD_READ

This topic is 2787 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

This topic is 2787 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this