If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Hybrid View

Server socket can connect few times only (Winsock C++)

Hi I am trying to write a server winsock in C++ to allow connection from PHP client code. The PHP will request the data from server, receive then close the connection. However, after 2-3 times of connection, when the PHP request again, it hang at the socket_read(), the page keep loading, and the server does not receive the FD_ACCEPT event. Is it because of TIME_WAIT that the connection is not yet closed ? Any suggestion on code improvement will be nice too.

Re: Server socket can connect few times only (Winsock C++)

Finally it works, I wasn't quite understand on the winsock functions, flow, etc. This is the working one. The key is to let the listener socket keep alive, then store the client/accepted socket in another place.