Protocols
Date: 10/29/05
(Web Development) Keywords: java
We're building a scrabble game for class, and are supposed to come up with a protocol for it. The game is to have a server & clients, with different rooms, etc.
My question is about the protocol - how they're generally implemented.
I understand that it's a separate class, but what does the class contain?
a) public static strings for commands and nothing else?
b) such strings, and also methods that take data, and return it combined with the strings? (e.g. serverthread.send(Protocol.LETTER_RACK(letterBag.getLetterRack())) where the returned string would be something like "LETTER RACK\n A B C D E F G")
c) the protocol class could send the data itself, if provided with a socket object.
d) something else?
I'd like to implement something that's been proven to be efficient.. any advice would be appreciated. Thanks!
(this is being done in Java, if it matters any)
Source: http://www.livejournal.com/community/webdev/262609.html