Skip to content

Commit

Permalink
close connection properly
Browse files Browse the repository at this point in the history
  • Loading branch information
mojombo committed May 24, 2008
1 parent 2e6f315 commit d8da04f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion elibs/server.erl
Expand Up @@ -76,7 +76,13 @@ gather_out(Port, DataSoFar) ->
stream_out(Port, Sock) ->
{data, Data} = readline(Port),
gen_tcp:send(Sock, Data),
stream_out(Port, Sock).
io:format("<= ~p~n", [Data]),
case regexp:match(Data, "0000$") of
{match, _Start, _Length} ->
done;
_Else ->
stream_out(Port, Sock)
end.

readline(Port) ->
receive
Expand Down

0 comments on commit d8da04f

Please sign in to comment.