Is it possible to mess up the programming in a universal remote?

Erlang (programming language): I'm really confused at openpoker gateway's method tcp_server: socket_loop/5. Just as the author say, "Don't mess with the following code unless you really know what you're doing.". Who can give it a explaination, what's the diff with {'Exit', New, _Why} and {'Exit', Pi

  • Answer:

    He kills the child process with  exit(oops)  when gen_tcp:accept fails, i.e. I guess in this case _Why will be equal oops. Anyway this is very old style of Erlang network programming, if you writing a new code, just use Ranch library written by the author of Cowboy web server.

Zvi Avraham at Quora Visit the source

Was this solution helpful to you?

Other answers

Thanks for all, I have added piece of key code at comment. Erlang's mailbox service is asynchronous. The master process socket_loop/5 receives all the message from child processes. When one of child processes finish its work, it will exit normal and be catched by the master process because  code_start/5 's process_flag(trap_exit, true), so  I have idea about  {'EXIT', Pid, _Why}, and  I even think _Why most time here would be normal, however we doesn't care about that.     I'm confused about {'EXIT', New, _Why}, does it mean a new child process exit abnormal when it try to accept client's request?

Smart Lee

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.