[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luasocket, udp, send/receive different max datagram size?
- From: Sean Conner <sean@...>
- Date: Sun, 19 Jun 2011 02:39:13 -0400
It was thus said that the Great Valerio Schiavoni once stated:
> Hello,
> I just noticed the following about LuaSocket's UDP support for send and
> receive.
>
> In receive (http://w3.impa.br/~diego/software/luasocket/udp.html#receive) :
>
> If size is omitted, the maximum datagram size is used (which is currently
> limited by the implementation to 8192 bytes).
>
>
> In send (http://w3.impa.br/~diego/software/luasocket/udp.html#send) :
>
> "The maximum datagram size for UDP is 64K minus IP layer overhead."
>
>
> What is the technical reason for not being of the same size ?
It could be a decent trade-off of space for embedded systems. If the
buffer is declared on the stack (as a local variable to a function) then
there could also be issues with a large local array (limited stack space).
Also, most UDP based protocols typically limit the packet size anyway, to
avoid fragmentation. The only UDP based protocol I'm aware of that uses
packets this size is NFS (okay, technically, sunrpc).
-spc