1. Users can avoid packet loss caused by the sender through programming. TCP provides an operation instruction push to force the data to be transmitted immediately. TCP software will send this data immediately after receiving the operation instruction, instead of waiting for the sending buffer to be full.
2. For the packet jam caused by the receiver, measures such as optimizing the program design, streamlining the workload of the receiving process and improving the priority of the receiving process can be taken to enable it to receive data in time and avoid the packet jam as much as possible;
3. Under the control of the receiver, a packet of data is received several times according to the structure field, and then merged to avoid packet adhesion.
Second, the implementation code:
Third, the method matters needing attention:
1. Although the first programming setting method can avoid the packet jam caused by the sender, it closes the optimization algorithm, reduces the network transmission efficiency and affects the performance of the application, and is generally not recommended.
2. The second method can only reduce the possibility of jamming, but it cannot completely avoid jamming. When the transmission frequency is high, or because the network burst may make the data packet arrive at the receiving end faster in a certain period of time, the receiving end may still be too late to receive it, thus causing the data packet to get stuck;
3. Although the third method avoids packet adhesion, the efficiency of the application program is low and it is not suitable for real-time application.
Fourth, the experimental environment
1, hardware environment: server: Pentium 350 microcomputer, client: Pentium 166 microcomputer, network platform: 10M * * LAN connected with special hub;
2. Software environment: operating system: windows 98, programming language: visual c++ 5.0.