gen_tcp and message handling

James Hague james@REDACTED
Thu Jan 6 04:36:54 CET 2005


Once you open a port with gen_tcp, by default all messages to that 
port are sent to the controlling process as normal Erlang messages. 
You use the receive statement to get them.  Slick!

When sending messages this isn't true.  You send a message via 
gen_tcp:send/2, not via the bang operator.  Is there a reason that 
you can't simply send messages to the port returned by 
gen_tcp:connect?  The main reason I'm asking is that it would be nice 
to register the Erlang port returned by gen_tcp:connect, then send 
messages to that name, rather than having to pass the TCP port number 
all around.

James



More information about the erlang-questions mailing list