Many sets of client and server using udp communication, rules of good communication protocol message type + number + + data message length, need through the message now serial number to determine whether a udp packets are lost, but because there are more than one client, so could not judging by accepting directly to the serial number of a message, to how to realize the detection of different client sends data to see if there is missing?
CodePudding user response:
If the communication protocol can change, the message number extension again, become ClientID + MsgID allocated by the server (ClientID)
Or simply by the server to maintain a hashmap, the KEY is the IP, the VALUE is a client object or message object
If there is a single client have more than one instance of communication situation, IP will be extended to IP + port