This is a conceptual programming question. I'm writing a tcp server/client program in Java.
The client program will be receiving multiple data types, and I'm trying to figure out how to properly determine which data type is being sent (otherwise I might try to convert a number to a custom data type or vice versa).
I was thinking about pre-empting any data transmission with a string character to alert the client program as to which type of data it would be receiving.
Is this a valid method of data transmission? It seems rather clunky.
Is there a better way to transmit different types of data at different times?