These pages that might provide some ideas on how to design a protocol (e.g., for a class project). One major choice to make is whether you make a textual (human-readable) or binary protocol. Then there are issues with framing messages. Do you start transmission by sending a message length, or does the protocol use some sort of sentry / end-of-message marker? Also, if making a binary protocol, consider endianness when sending integers.