[erlang-questions] Manning OTP questions

Ben Hsu benhsu@REDACTED
Tue Jun 10 01:41:44 CEST 2014


I am reading the Manning OTP book ( http://www.manning.com/logan/ ,
https://github.com/erlware/Erlang-and-OTP-in-Action-Source ), and I have
three questions:

In chapter 3, which is about the RPC server, I'm not sure how OTP hooks up
with gen_tcp. I see that tr_server.erl calls gen_tcp:listen, but I don't
see how TCP requests are passed to handle_call or handle_cast. I'm also not
clear on how TCP requests are transformed into Erlang function arguments.

In chapter 6, which is about making a network cache, I'm not sure how the
timeout works. I see that sc_element:handle_call gets the Starttime and
Leasetime from the State variable, and computes a time left. I'm not sure
how the time left variable is used to expire the cache. I thought there
will be a line of code where we check if Timeleft < 0, but I can't find any
such line. Is this handled inside OTP?

Thank you. I am very excited to be learning OTP
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140609/be76b1ca/attachment.htm>

More information about the erlang-questions mailing list