-1

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
  • 1
    UDP's limit is 65535 bytes, though the MTU of the medium is usually much less. Ethernet typically has a MTU of 1500 bytes, so a typical UDP packet of ~1470 should be fine, certainly the ~650 bytes in your Q should fit on any modern network. The minimum size that's guaranteed to work is 576 (assuming RFC conformity). Check firewall rules? I've vaguely heard of firewalls that drop UDP packets over 600 bytes to provide some level of DoS protection. – Chris S Jun 27 '14 at 13:59
  • @ChrisS I check the iptables and seems to be empty. – E_Blue Jun 27 '14 at 14:18
  • Could you post the relevant code (ie, buffer, packet, and socket declarations, send/receive method, and any "other" stuff going on related to those)? – Chris S Jun 27 '14 at 15:31
  • Yes, but is a bit messy because is a huge project and have a lot of routines calling another routines, sort of russian mamushka; so I don't know if you can deduce something just from the code, cause is partial. Do I post the code anyway? – E_Blue Jun 27 '14 at 15:54
0

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.

  • Could also be an undersized buffer on the receive side, or a variety of other things. I'm pretty sure the problem is in the code somewhere too. – Chris S Jun 27 '14 at 16:14
  • Solved! It was a limit on JAVA application, I was looking for the number 584 on all the source code but the limit was set on 600. I don't understand why if the limit is 600 the application only read 584 bytes. – E_Blue Jun 27 '14 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.