[erlang-questions] sending packets using gen_udp

igwan igwan@REDACTED
Mon Jul 30 20:56:53 CEST 2007


Hi,

I have a process that sends a number of UDP packets at a time using 
gen_udp:send/2 .
I open the socket with :

{ok, Socket}  = gen_udp:open(Local_port, [binary, {sndbuf, 16#100000}])

then I send my 100 binary packets in a loop (1472 * 100 = 147200 bytes 
so this shouldn't fill my send buffer). gen_udp:send/2 returns 'ok' each 
time, but only 9 packets reach my network interface. Only when I send 
200 or more packets at a time I get {error, eagain} but still only 9 
packets reach the interface.

Why do packets get lost before being sent and without an error ?

The systems seems to limit my send buffer  ...

 >inet:getopts(Socket, [sndbuf]).
{ok,[{sndbuf,262142}]}

... but there is room for a lot more than 9 packets.

My server is (Debian) Linux 2.6.18.1 i686 GNU/Linux and
OTP R11B-5 [source] [async-threads:0] [hipe] [kernel-poll:false] [hybrid 
heap]

Thanks for your help

igwan



More information about the erlang-questions mailing list