In UDP messages don't come in order so I guess I can't realize what's incoming data by some data that arrived before? I thought that I could recognize structure type by structure's size? and then convert it to proper structure types in my program.
Note that I'm assuming that you know what the packet is through some data that comes before the packet. And, if you're on TCP, I'm assuming you know how big the data is, again through some data before the packet.
And everytime I send a struct with game data there is a header data as well, which is char header. I'm getting quite confused... The header data is used only to recognize that incoming packet comes from good source?(my server) or not? And is that a good approach or a waste of bandwidth to send such a header data with every sturct I'm sending?