hi all, i'm working on a network programming assignment about writing a simple IM system (pretty much like the simplest version of windows messenger).
the spec specifies that i must send over 4 fields of data in a single datagram packet, those are: To From Type Message where type refers to message type, implemented as a user defined enum class.
I would like to be taught how to pack all these datas into a single packet.
Thx.
UPDATE: thx for the help so far, but say i have String sentence and String From the normal way to patch the packet individually would be byte[] sendData = new byte [256]
sendData = sentence.getBytes(); but how exactly can i append the "from" string to sendData along with the sentence string?