Writing a "Protocol" - Stumped.
been trying to figure out the best way to do this for a while and have tried the web but cant seem to find a definate answer.
with a client / server scenario I need to create some kind of protocol for the two to speak the same language.
lets say I have two clients and one server, both clients connected to the server and I need to just display movement with an up arrow key moving 1 sqaure up, down arrow key 1 square down etc with both clients being able to see what the other is doing. Ive adopted the idea of sending the data to the server and the server sends the clients the updates rather than client to client.
Now i know FTP, etc use commands like STAT,PASS, etc etc. but is this data just sent in a string with a common deliminater and broken up server side ?
I was considering having a struct on the server which holds all incoming data but my question is whats the most efficient way to break up the data coming in ? The idea of stripping a string of incoming data would seem too slow on a large scale ?
So at the moment im looking at <userid>:<command>:<end of data marker> or something like that, sending in a string and stripping it on the server.. slow? bad idea? really sounds it but im stumped as to an alternative. I cant send data structures to be re-assembled can i ?
Anyone have any pointers or suggestions where to start ?
Thanks in Advance,