Which process read the socket?

Hi,
I am a student reading erlang source code, and I knew a little OTP and read that ejabberd_receiver is the controller process of the TCP socket, but as far as I learned, the process should use the expression like receive ... end to receive the data, but I cannot find it. And in the same module (ejabberd_receiver), I see the clause handle_info({Tag, _TCPSocket, Data},
#state{socket = Socket,
sock_mod = SockMod} = State)
looks like receiving the data, is that right?

One more question, the relation between ejabberd_c2s.erl and ejabberd_receiver is 1 to N or N to N?

Thank you.

Re: Which process read the socket?

foreverqihe wrote:

I see the clause handle_info({Tag, _TCPSocket, Data},
#state{socket = Socket,
sock_mod = SockMod} = State)
looks like receiving the data, is that right?

Yes. Refer to documentation of gen_server: http://www.erlang.org/doc/man/gen_server.html

foreverqihe wrote:

One more question, the relation between ejabberd_c2s.erl and ejabberd_receiver is 1 to N or N to N?

It is N to N.

Thanks

Thanks

Syndicate content