Java discards half of UDP packets

I have a simple client / server setup Server in C, the client of the query server is Java

My problem is that when I send bandwidth intensive data over a connection, such as video frames, it discards half of the packets I ensure that UDP packets are correctly split on the server side (the maximum payload length of UDP is 2 ^ 16) I verified that the server is sending packets (printf is the result of sendto()) But Java doesn't seem to get half the data

In addition, when I switch to TCP, all video frames pass, but the delay begins to accumulate, adding a few seconds after running for a few seconds

Do I have any obvious loss? I can't seem to figure that out

Solution

Get networking tools like Wireshark so you can see what's happening on the line

UDP does not attempt retransmission, so if a packet is discarded, the program will deal with the loss TCP will try to send all packets to the program in order, discard duplicates and request the lost packets If you see high latency, I bet you will see a lot of TCP packet loss, which will be displayed as retransmission from the server If you don't see TCP retransmission, the client may not process the data fast enough to keep up

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>