I am making a chat client that receives structs of info from the server over a UDP socket in varying amounts. Each one of these structs starts with a header that tells the client what type of struct it is. Is it possible to use recvfrom
to retrieve the entire struct, no matter what the size is, and then cast it to whatever struct I need based on the header, or do I first have to read the header, determine the struct, and then read in the struct piece by piece?
質問する
177 次