Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can UDP packets be really lost when PC connects to itself

Tags:

java

udp

voip

Scenarion: VOIP - Sending and Receiving UDP packets at the same time

I have problem when pc connects to itself(for testing purposes). It seems that it looses packets, it doesn't happen though when connecting to the second machine through router wireless. Which is kinda frustrating as I spent 14 hours just to find out that the problem was not in my logic, but rather in a simple case packets never get received.

I have two laptops different benchmarks, both loose packets when connecting to themselves..

   sender.start();
    receiver.start();

I believe it is something to do with the threading or the nature of NICS. If I remember correctly to either receive or send it changes modes - but because of two threads it can't keep up with them? Am I incorrect?

Why does this happen?

like image 874
Aubergine Avatar asked Dec 04 '25 02:12

Aubergine


1 Answers

Since you don't mention it in your question, I would advise you to try increasing the size of the UDP receive buffers to see if that makes a difference.

This will also cause less packet loss when running your application over the network (sooner or later packet loss will occur there too).

AFAICT this can be accomplished in Java using the Socket.setReceiveBufferSize.

like image 101
Ralf Avatar answered Dec 05 '25 16:12

Ralf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!