I've got a program, a board game, that plays over LAN. I used Asynchronous sockets to connect the server and the client, so that the server won't hang until the client responds. The game flow would be like this:
Player A starts server by typing in a Port number
Player B connects to the server by typing in host IP and Port number
Player A receives a "Player B connected", and must send some settings back.
Player B receives settings from Player A (location of player, as well as who goes first)
One of the player goes first. The other follows.
At any time, players can chat with each other.
Now, I got the connection part right. The client even sends a "Player Name connected" message. But because I based my code on a Asynchronous Chat application, I'm not sure how to proceed, or rather, how I can get my server to send some settings (mostly just ints) that the client will read as settings, instead of a message.
So, basically, I'm asking for some logical help here. Do I make another function similar to the one sending messages, but sends integers instead? Or will that mess with the connection, since the client is expecting a message? Or something else will go wrong?
I'm just a beginner in socket programming. Thanks in advance for all those who will reply, and sorry if it is a bit long. I will post the codes if necessary / on demand.