[erlang-questions] gen_udp:send and concurrent access to the same Socket

Bengt Kleberg bengt.kleberg@REDACTED
Wed May 5 10:47:32 CEST 2010


Greetings,

Any processes can send on a socket. Only the owner can receive on a
socket.

>From a design point of view it would seem better to me with a single
process that does all the sending. If that is not possible given your
performance requirements (measure) you can send from all processes.


bengt

On Wed, 2010-05-05 at 10:31 +0200, mayamatakeshi wrote:
> Hello,
> I'm testing with gen_udp.
> I want to pass the same Socket to several different processes so that they
> can use it to send messages to an external endpoint from time to time. The
> processes don't care about responses for the messages they send.
> So, is it OK to call gen_udp:send/4 from more than one process passing the
> same Socket?
> My doubt is if gen_udp:send/4 takes care of concurrent access or if I should
> do it myself, sending the packet to be transmitted as a message to a process
> that owns the Socket.
> 
> br,
> takeshi



More information about the erlang-questions mailing list