For the past 2 days I’ve been investigating why my RUDP protocol has a waay worse ping than the one in iperf. I found numerous bugs and optimizations during this time but I was never able to get the ping below 100ms while iperf in udp mode was getting 3-7ms…
It turns out that using broadcasting increases the RTT a lot and causes some packet loss. Maybe it’s just my network that behaves like this with broadcasting but after I removed it my ping was a solid 4ms. Not too bad for wifi going through 3 walls..
So the culprit was this line:
I did this a few days back when I got too lazy to implement proper discovery so I made all comms broadcast.