I have used a packet protocol which allows for a byte to specify a different kind of packet. This could include private messages, specially formatted open messages, or just about anything else you can think of. We could create a broken up message which could be any packet type that was over 253 bytes. The packet could then be broken into 253 byte chunks and sent separately. The possibilities are almost endless here.
Imagination is the only limit.
Now that I have described what goes into the client program I will begin to put it all together. As I said before, the client contains two threads. The user interface thread handles the user input and server output and the connection of the client to the server. The two threads will talk to each other via user defined messages. Take a look at Figure 2.