[erlang-questions] Line Receiver example?

Jarrod Roberson jarrod@REDACTED
Mon Apr 27 21:56:21 CEST 2009


2009/4/27 Jarrod Roberson <jarrod@REDACTED>

>
> get_line(Socket) ->
>     receive
>         {tcp, Socket, Bin} ->
>             io:format("Received Line:~p~n", binary_to_list(Bin)),
>             get_line(Socket);
>         {tcp_closed, Socket} ->
>             io:format("Connection Closed!~n")
>     end.
>
>
thanks to something in Joe's email, I got this to work sort of.

I changed the above to :

get_line(Socket) ->
    receive
        {tcp, Socket, Bin} ->
            io:format("Received Line:~p~n", [Bin]),
            get_line(Socket);
        {tcp_closed, Socket} ->
            io:format("Connection Closed!~n")
    end.

and I started getting output.

question now is how do I get that binary to a list that I can manipulate?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090427/2670c58d/attachment.htm>


More information about the erlang-questions mailing list