Hi,
I am fairly new to java and have an implementation question. I am trying to send/receive a message from a Java GUI through a socket to a process developed in C which will transmit/receive and parse the message. On the C end of the message link, messages will be packed/unpacked using a 16-bit command code (first two bytes of the message) which then tells the parser how the rest of the message data should be interpreted. For instance, this system may have 3 message command codes, A, B and C. Command A will also transmit a integer of data, command B will transmit 2 integers of data and command C will transmit a buffer of 16 chars. On the C end, I would typically use a structure made up of an enum for the command codes and a union of structures to represent the data. This way I can parse the message and populate the data types easily. My question is, what is the best way to implement this message interface in Java? I need to easily pack and unpack messages of various sizes with different message content types as simply as possible. Any suggestions would be greatly appreciated.