MultiThreading Winsock Question
Posted on 2003-03-30
I am working on a game. The server can accept 5 winsock connections say ports 9991-9995. However, the client and the server are actually the in the same .exe file meaning anyone can be the server. So if that person is the server he will execute the following
.LocalPort = 9991
.LocalPort = 9992
But if he is the client only, the will skip this and execute a connection to one of those ports.
.RemoteHost = ServerIP
.RemotePort = ServerPort
How do I implement it properly? So when a person joins he is connected to the an available port. When someone quits, I know which ports r free that can be assigned. How do i send a message to all of them at a time?
Do i need to use threading? If so how? I tried but it fails on the 'listen' of IMSWinsockControl part.