Advertisement

stuck on Listen()

Started by August 16, 2003 06:44 PM
3 comments, last by GekkoCube 21 years, 5 months ago
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?
non-blocking sockets

Although, I''m surprised that you were able to make networked Pong with blocking sockets!
Advertisement
How does listen() lock the server? Are you referring to some kind of loop that makes calls to WSAAccept() for incoming clients?

Kuphryn
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.
You could spawn another thread, which handles the listen.
Look up CreateThread or something like that on MSDN.

This topic is closed to new replies.

Advertisement