Re: [erlang-questions] A small question about TCP Socket of Erlang

Yan Yan yan.beijing.china@REDACTED
Sun Nov 29 04:15:32 CET 2009


Hi Ngoc,

Thanks for your reply. But I am still confused on the message passed between ends.

Is the message passed from client to server {tcp, SocketOnClient, BinData}, while server to client {tcp, SocketOnServer, BinData}? I am quite confused why there is a match within receive...end block of both ends, since SocketOnClient and SocketOnClient do not match.

Sincerely,

Yan
2009-11-28



From: Ngoc Dao
Time:  2009-11-28 16:02:34
To: erlang-questions
Fw: 
Subject: Re: [erlang-questions] A small question about TCP Socket of Erlang

> Why is there a match? SocketOnClient =:= SocketOnServer? Do server and client share the same socket after connection is set?
No. SocketOnServer in step 3 is for matching with SocketOnServer in
step 2. SocketOnServer and SocketOnClient are just values and
independent. To see their values, use io:format("~p~n",
[SocketOnServer]) and io:format("~p~n", [SocketOnClient]).
I think you're confused because of the resemblance of the code for
server and the code for client. But actually this is the beauty of the
design of the API.
________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org


More information about the erlang-questions mailing list