I can send a UDP packet of 15,750 bytes(15K bytes).When i send a packet beyond this limit from my Android client application i cant receive it at server.I cant receive even 1 byte of d开发者_C百科ata at server that i sent from client.Is this maximum limit?Theoritically UDP packet supports 65,535 bytes.I want to know what is the practical limit? Is this limitation of Android or Mobile or Mobile network carrier?
I know that question is old, but it's displayed as first link when you google problems with UDP packets delivery. If anyone has a similar problem, here is what I found:
The problem is described here: RFC 1191 - Path MTU Discovery. 65,535 is theoretical size: this is a max value that can be stored in Length
field in UDP Header (16 bits). In practice not all network members can handle that big packets.
There is also nice explanation here: Path MTU discovery in practice
One commonly used workaround is to reduce the MTU for all of the outgoing packets. The minimal required MTU for all IPv6 hosts is 1,280, which is fair. Unfortunately for IPv4 the value is 576 bytes. On the other hand RFC4821 suggests that it's "probably safe enough" to assume minimal MTU of 1,024. [...] Forcing a reduced packet size is not an optimal solution though.
There are also more advanced techniques described later in this article.
I'm guessing you are using Java. You may be running into an issue as detailed in http://docs.oracle.com/javase/6/docs/api/java/net/DatagramSocket.html#getSendBufferSize()
SO_SNDBUF on my Oracle Java 6 JVM is 4097 bytes, but the implementation handles larger ones at least on Windows. I'm not sure about Android's implementation.
You do know at least that the minimum is 500 something bytes. I forget the reference for that.
精彩评论