I'm currently developing a remote desktop application, and I have stumbled across one major issue. Keep in mind I am using a simple TCP library that sends data to the server like so: MainClient.Send(Byte[] Data);
The problem i'm having is I need to be able to differentiate the data, like attaching a header to the data so the server knows what to do with it. The current solution I have is switching a bool on and off based on if the client is streaming the screen so the server knows what to do with the data its receiving. (While the bool is true, any data received is automatically converted to an image.)
How can I do this within a sensitive byte array that is carrying an image then have the server be able to read the header to tell what it is. (So I can carry out multiple other functions with the client at the same time)