[erlang-questions] UDP concurrent server

Bogdan Andu bog495@REDACTED
Wed Dec 9 09:29:07 CET 2015


I want to build a concurrent udp server in Erlang, but it seems to not
be possible.

After more tests and investigation the questions that remains ..

Is there a way to have more than one process be blocked
in gen_udp:recv/2 call as this seems to not be possible, 
probably because the way udp sockets work.

Sequentially works as expected, but when when I try to spawn another process
that makes and attempt to execute gen_udp:recv/2 while the first process 
already does
gen_udp:recv/2 , the second process gives elready error. This means that 2 
cannot concurrently do gen_udp:recv/2 .

In scenario with socket {active, once} or {active, true} there is only one 
process that can
receive the message from socket (the one that does gen_udp:open/2 ), 
and for multi-threaded applications this quickly can become a bottleneck.
In this case, however, elready error disappears of course. 
I tried both variants and both have disavantages.

Is there an idiom for designing a udp concurrent server in Erlang?
So far, it seems impossible.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20151209/58f38438/attachment.htm>

More information about the erlang-questions mailing list