Basically, I'm working on a P2P simulation, and I need to set up messages to be sent from one peer to another. These messages need to be formatted in a certain way, such that bytes 0-15 of the message represent one field, byte 16 another field, etc. These messages must be sent as Strings.
I'm really lost on how I should be constructing these strings. For example, one field is essentially just a randomly generated number that goes in bytes 0-15...I have no problem generating the value that should be in the field, but as far as getting it into bytes 0-15 of a message I have no idea.
After constructing and sending the
string, it then must be picked apart by the peer receiving the message...this would be pretty easy to do using bitmasks, but again, I am really lost as to how to set those up in
Java.
To make matters worse, the fact that some of these fields need to be little-endian and some of them big-endian is really screwing with my head...I dont know if my data is going to be in the right order even!
Any advice or nudges in the right direction would be GREATLY appreciated.
Thanks.