[erlang-questions] Simple tcp server
Sun Jan 16 19:02:04 CET 2011
The gen_server is the controlling process of the listen socket, when
you terminate the gen_server, the gen_tcp:accept(Socket) will return
error with reason closed, and it goes endless loop in your accept()
process, so your CPU hits 97-100%.
You can catch [error, closed} for gen_tcp:accept(), and close the listen socket.
On Sun, Jan 16, 2011 at 12:36 PM, shk <> wrote:
> I'm new in erlang and try to write simple tcp server.
> Code : https://gist.github.com/781975 My Code
> I start server, then connect some client with help telnet. When I try to
> stop it i call stop() And after it thats CPU engaged 97-100 %. I think that
> i must close socket. How can I make it correctly? And just do the correct
> terminate server?
> Thank you.
> View this message in context: http://erlang.2086793.n4.nabble.com/Simple-tcp-server-tp3220218p3220218.html
> Sent from the Erlang Questions mailing list archive at Nabble.com.
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
More information about the erlang-questions