[erlang-questions] Dispatch arrived gen_udp messages

Bengt Kleberg <>
Mon Mar 7 16:19:49 CET 2011


It is likely that the caveat for gen_tcp:controlling_process/2 also
holds for gen_udp:
"If called by any other process than the current controlling process,
{error, eperm} is returned."
If so it would be nice to include it in the documentation.


bengt

On Mon, 2011-03-07 at 10:29 +0100, Edward Wang wrote:
> Thanks, Bengt. This seems to do the trick.
> 
> 
> Only that gen_udp:controlling_process/2 will have effect if being
> called by its current controlling process in my test (mac os x). Not
> sure if that'll be true for other platforms. The document
> doesn't explicitly say. I guess it's better to spell this out.
> 
> 
> Edward.
> 
> On Mon, Mar 7, 2011 at 5:02 PM, Bengt Kleberg
> <> wrote:
>         Greetings,
>         
>         I think you are looking for gen_udp:controlling_process/2
>         Please check the documentation (ex:
>         http://erldocs.com/R14B01/kernel/gen_udp.html?i=2&search=gen_udp#controlling_process/2.
>         
>         
>         bengt
>         
>         
>         On Mon, 2011-03-07 at 09:54 +0100, Edward Wang wrote:
>         > I gen_udp:open/1 a udp socket in one process, gen_udp:send/4
>         some packets in
>         > another using that socket. It seems process that opens the
>         socket gets
>         > arrived udp messages. Is there a way to get these udp
>         messages dispatched to
>         > the process send them? Of course I can dispatch them myself.
>         I just wonder
>         > if there's build-in mechanism to do the same.
>         >
>         > -Edward
>         
>         
>         
>         ________________________________________________________________
>         erlang-questions (at) erlang.org mailing list.
>         See http://www.erlang.org/faq.html
>         To unsubscribe; mailto:
>         
> 
> 



More information about the erlang-questions mailing list