• Advertisement

Archived

This topic is now archived and is closed to further replies.

stuck on Listen()

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

my first app was a Pong clone using TCP/IP. It worked great for the most part, except for one bug. If no clients connect to the server, the server will simply Listen() indefinitely. Nothing will work except a hard-reboot/reset button. what is a way around this?

Share this post


Link to post
Share on other sites
Advertisement
non-blocking sockets

Although, I''m surprised that you were able to make networked Pong with blocking sockets!

Share this post


Link to post
Share on other sites
How does listen() lock the server? Are you referring to some kind of loop that makes calls to WSAAccept() for incoming clients?

Kuphryn

Share this post


Link to post
Share on other sites
yes, thats exactly what i did.
since this version of network pong is a server client setup (with a max of 1 client) it is essentially a peer-to-peer in the end.

the server listens(), and when it received a connect request, it accepts. then, and only then, will the game begin or quit.

Share this post


Link to post
Share on other sites
You could spawn another thread, which handles the listen.
Look up CreateThread or something like that on MSDN.

Share this post


Link to post
Share on other sites

  • Advertisement