[erlang-questions] Problems with sending UDP datagrams without buffering

Oscar Hellström <>
Wed Oct 29 16:12:52 CET 2008


Hi Mark,

I don't have very much experience with UDP but I'm quite sure that Erlang itself doesn't do any buffering. If you look in erts/emulator/drivers/common/inet_drv.c You will find exactly what is going on though :)

----- "Mark Geib" <> wrote:

> Sorry for lack of details, it was the end of a long day.
> 
> Yes, I am using UDP, not TCP. And to confirm, I am sending 700 bytes,
> never any more. I see the 7000 byte datagram in WireShark on another
> system monitoring the network. The 7000 bytes are reported as
> fragmented
> packets that have been re-assembled. I am an sending the 700 bytes
> every
> 20 miliseconds.
> 
> I am assuming that erlang is buffering in a lower layer, but could be
> the linux network stack as well.
> 
> Mark.
> 
> 
> 
> Johnny Billquist wrote:
> > Matthias Lang wrote:
> >>> Mark Geib wrote:
> >>>> I have a case where I MUST send datagrams that are smaller than
> a
> >>>> network frame. The device I am sending to will not except larger
> >>>> datagrams.
> >>
> >>>> I am sending message that are less than 700 bytes in length, but
> on the
> >>>> network using a sniffer I periodically see datagrams from the
> >>>> application that are 7000 bytes or so in size. The data is
> correct, the
> >>>> end device will not accept.
> >>
> >>>> I am sending these datagrams about every 20 miliseconds.
> >>
> >>>> Is there an option I am missing to force every gen_dup:send() to
> cause
> >>>> the datagram to be sent.?? I am running on linux 2.6.27 kernel.
> >>
> >> On Wednesday, October 29, Johnny Billquist wrote:
> >>> If you are using TCP, there are no such concept as a datagram. TCP
> is
> >>> a stream oriented connection.
> >>
> >> I don't understand the original poster's question.
> >>
> >> For starters, he says he's using "gen_dup:send()". There is no
> >> gen_dup. I'm guessing it's a typo for gen_udp:send(). So it can't
> be TCP.
> >> Or can it?
> > 
> > I was making the (probably wrong) assumption that he was actually
> > meaning gen_dup. :-)
> > 
> >> But if I assume that, then the only way to get a "datagram" (does
> he mean
> >> "UDP payload" or does he mean "IP packet" or something else? I
> don't
> >> know)
> >> 7000 octets long is to pass a 7000 octet argument to gen_udp:send.
> > 
> > If he is sending 700 bytes packets with UDP, I can't see how the
> total
> > packet length could become 7000.
> > Can Erlang also buffer sends internally? I wouldn't have thought so,
> but
> > it's not entirely clear from the documentation.
> > 
> >     Johnny
> > 
> > 
> 
> -- 
> Principal Engineer
> Cheyenne Software Engineering
>  / 35-215
> 
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions

Best regards
-- 
Oscar Hellström, 
Phone:  +44 (0)798 45 44 773
Mobile: +44 (0)207 65 50 337
Web:    http://www.erlang-consulting.com




More information about the erlang-questions mailing list