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

mayamatakeshi mayamatakeshi@REDACTED
Thu May 6 14:12:35 CEST 2010


On Wed, May 5, 2010 at 5:47 PM, Bengt Kleberg <bengt.kleberg@REDACTED>wrote:

> 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.
>

Yes. That's the thing I was anticipating; I got problems losing
(inter-process) messages when using a single process to control a TCP socket
so I thought the same would happen with gen_udp.
Thanks.

br,
takeshi


>
>
> 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
>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>


More information about the erlang-questions mailing list