<div dir="ltr"><div><div><div><div><div><div><div><div><div>Hi,<br><br><br>I want to build a concurrent udp server in Erlang, but it seems to not<br>be possible.<br><br>After more tests and investigation the questions that remains ..<br><br></div>Is there a way to have more than one process be blocked<br></div>in gen_udp:recv/2 call as this seems to not be possible, <br>probably because the way udp sockets work.<br><br></div>Sequentially works as expected, but when when I try to spawn another process<br></div>that makes and attempt to execute gen_udp:recv/2 while the first process already does<br>gen_udp:recv/2 , the second process gives elready error. This means that 2 process <br>cannot concurrently do gen_udp:recv/2 .<br><br></div>In scenario with socket {active, once} or {active, true} there is only one process that can<br></div>receive the message from socket (the one that does gen_udp:open/2 ), <br>and for multi-threaded applications this quickly can become a bottleneck.<br></div><div>In this case, however, elready error disappears of course. </div>.<br></div><div>I tried both variants and both have disavantages.<br></div><div><br></div>Is there an idiom for designing a udp concurrent server in Erlang?<br></div>So far, it seems impossible.<br><br>/Bogdan<br></div>