Posted on 2005-04-10
I am making a multi-player card game. I am going to have a server application. The server is going to be able to handle multiple games as well. I have a few questions.
I plan on making a GamePacket class with fields that will pertain to the game. This is the data that will be sent via ObjectOutputStream and recieved via the ObjectInputStream. I am going to put a GameID field for the server to be able send the socket to the right Game thread. Is this a good way to do this? How is this usually done?
Should the client be constantly requesting updates for the game? Or should the game just send out game information? I mean, once the intial connection is made I could just get the IP address and have the client listening on a port. But, I don't know if the clients firewall will block this. How does this work?
Overall, what is the best way to handle a multiplayer/multigame server application?