Set udp packet size limit

I have a CentOS server with a JAVA application that receive UDP data packets, it works all OK until the packet is bigger than 584 bytes, I read something about and seems to be a limit of UDP protocol.

My bigger packet is 631 bytes length(payload)

I test to send 631 bytes, in the same net, from one Windows machine to another Windows machine and seems to work OK, but if I send the same date to the CentOS server, the server only catch the first 584 bytes.

I sniff from the Windows machine with Microsoft Network Monitor 3.4 and the packets are not being fragmented.

Did I must to set some system parameter on the server?
Is a limit of the JAVA machine?

Could somebody guide me please?
I’m new on this.
Thanks.

I check the iptables and seems to be empty.

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Answer

I test to send 631 bytes, in the same net, from one Windows machine to another Windows machine and seems to work OK, but if I send the same date to the CentOS server, the server only catch the first 584 bytes.

That does not make much sense.
With UDP you receive either the full packet or nothing, unless the application explicitly calls send with a length smaller than the packet and set also MSG_TRUNC to accept packet truncation. So any limits here must be done by the application.
An UDP packet itself can be up to 64k and I’m sure that Java itself does not change every receive call of the application to use a small length only, otherwise lots of other Java-based applications would have problems.

So please check how the reading is done inside the application. I assume that their is an explicit limit when reading. You might also run the application with strace and check how the application calls recv or recvmsg, there you might see the size the application requests.

Of course it could also be, that the application never receives the packets because the get filtered outside the application. In this case you should check with tcpdump/wireshark if the packets arrive at the machine at all, e.g. don’t check at the sender side but at the recipients side.

Attribution
Source : Link , Question Author : E_Blue , Answer Author : Steffen Ullrich

Leave a Comment