[erlang-questions] sending packets using gen_udp

igwan igwan@REDACTED
Thu Aug 2 21:40:09 CEST 2007


Chandru a écrit :
> I wrote some C code to test this and it turns out that I get a similar
> behaviour. I actually see more lost packets when running the C program
> compared to erlang.
>
> So I don't think this is an erlang specific problem. I think the
> packets are being dropped somewhere in the kernel and this being UDP,
> you are not being told about it. I've attached the C code in case  you
> are interested in trying. Edit the macros in the code to change the
> "destination host" and "send buffer size".
>
> cheers,
> Chandru
>   

Many thanks for taking time reproducing this. Well, I modified kernel 
parameters  /proc/net/core/wmem_* and /proc/net/core/rmem_* (they're 
buffer sizes) then restarting the emulator with no effect. Besides, I 
notice in prim_inet.erl, this funny little comment :

%% SENDTO(insock(), IP, Port, Data) -> ok | {error, Reason}
%%
%% send Datagram to the IP at port (Should add sync send!)

So there exists a sync send call that erlang could use and that blocks 
until - i'm speculating - the datagram is taken out of the kernel send 
buffer ?
I'm no C programmer, but the socket interface seems to have different 
calls (send sendto sendmsg) for sending datagrams.

I'll give a try at the TunTap driver from Jungerl to see if I can go 
around the problem.


igwan




More information about the erlang-questions mailing list