Description:
# 1, C represents the photos sent by the client machine, # S on behalf of the receiving server machine,
2, the picture is broadcasting real-time transmission, so must make sure the data correct and no packet loss,
Thought:
1, using UDP broadcast data, data structure that contains the C # number, # S according to immediately determine whether receive completely, for example, 1 machine didn't accept the sending data, the no. 2 machine and photos, then make it this time to create a new gadget (array? Flow? To store the no. 2 machine, machine will continue to receive 1 data at the same time, if this time no. 3 machine sent a thing again, then again to create a new thing to store 3 machine data,
2, the premise is uncertain how many client machine, so the receiver to real-time ready to create a gadget receives a new data, and write INI, start reading INI will know that the last time the next time how many sets of C #, you don't have to dynamically create, create good directly,
3, if the receiver, so should be saved to empty, and then continue to receive this machine number of data, for example, 1 finished machine data reception, so be prepared to receive the next machine bag, 1 # S according to send me each name to judge whether the image needs to receive,
Question:
How the receiver data structure defined? Create what data to store the new number, array? Flow? Fairy, o how to build, the way,
One-to-one, one-to-many data reception structure:
Type
PicData=https://bbs.csdn.net/topics/^ TPicData;
TPicData=https://bbs.csdn.net/topics/record
Msgtype: TAVMsgType;//1 command;
Index: byte;//1 which one package;
Num: byte;//1 total packages;
DLen: integer;//4. This packet payload data length (Info)
Data: Pointer;//4 this package effective data pointer;
Cid: byte;//1 number (
Name: AniString;//4 name
Many-to-many data reception structure
Type
PicData=https://bbs.csdn.net/topics/^ TPicData;
TPicData=https://bbs.csdn.net/topics/record
? :?
CodePudding user response:
CodePudding user response:
The client size, real-time performance, stability requirements, lead to the communication system of a pot to do well, have a lot of pit to bypass theDon't consider these, the demo can be achieved: the socket server controls, itself can be a multithreaded, each thread service a special connection
CodePudding user response:
Certainly should be kept as file,CodePudding user response: