gen_udp looses datagrams

Vance Shipley vances@REDACTED
Thu May 18 18:07:47 CEST 2000


We're finding that when we have an active UDP socket
we can, and do, loose incoming datagrams.  At times
we will receive only the latter of two packets sent
immediately after one another.  Why would this be?

	-Vance

The following demonstrates:

-module(test_udp).
-export([start/1]).

start(Port)->
        {ok, Socket} = gen_udp:open(Port),
        gen_udp:send(Socket, "foo", 4000, "Please send me two packets!"),
        loop(Socket).

loop(Socket) ->
        receive
                {udp, S, A, P, M} ->
                        io:fwrite("~s ~n", [M]),
                        loop(S)
        end.



Erlang (BEAM) emulator version 4.9.1 [source]

Eshell V4.9.1  (abort with ^G)
1> test_udp:start(5000).                          
Here's the first one you asked for.
Here's the second one you asked for.


BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
       (v)ersion (k)ill (D)b-tables (d)istribution

$ erl
Erlang (BEAM) emulator version 4.9.1 [source]

Eshell V4.9.1  (abort with ^G)
1> test_udp:start(6789).                          
Here's the second one you asked for.




More information about the erlang-questions mailing list