Skip to content

Commit

Permalink
Shutdown gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinvichnal authored and CrowdHailer committed Sep 21, 2016
1 parent 372a62c commit f8efd43
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server.ex
Expand Up @@ -52,6 +52,10 @@ defmodule TCPEcho do
{:ok, message} ->
TCP.send(socket, "ECHO: #{String.strip(message)}\r\n")
loop(socket)

# Shutdown gracefully if the client unexpectedly closed the connection
{:error, :closed } ->
IO.puts("Socket connection closed")
end
end
end
Expand Down

0 comments on commit f8efd43

Please sign in to comment.