[erlang-questions] UDP active socket timeout

Sean Cribbs seancribbs@REDACTED
Thu Feb 4 15:43:11 CET 2016

UDP is a connection-less datagram protocol, so there's no timeout inherent
in the protocol.  However, you may have timeouts on:

1) receiving a datagram (nothing arrived)
2) sending a datagram (things went very badly)

However, those are timeouts internal to Erlang, from your process to the
socket driver. If you are using the {active, true} option (which it sounds
like you are), you should use an 'after' clause in your 'receive' to
implement timeouts, or use the trailing timeout in the return tuple of a
gen_server/gen_fsm callback.

On Thu, Feb 4, 2016 at 6:29 AM, Bogdan Andu <bog495@REDACTED> wrote:

> Hi,
> How can be detected a timeout on an active UDP socket?
> controlling process receives the message:
> {udp, Socket, Host, Port, Bin}
> and after a process is spawned to handle that data:
> spawn(fun() -> handle_pckt(Socket, Host, Port, Bin) end),
> Q: how the spawned or controlling  process is able to detect
> that a timeout on this UDP socket occurred ?
> documentations does not mention anything about timeout on active sockets
> Thanks,
> /Bogdan
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160204/1de69699/attachment.htm>

More information about the erlang-questions mailing list