[erlang-questions] 1st day of Erlang: what is wrong with this code

Bob Ippolito <>
Sun Jul 12 11:58:05 CEST 2015


Data is likely a binary(), not a string(). You can use the unicode module
to go between binary data and lists of characters:
http://www.erlang.org/doc/man/unicode.html

On Sun, Jul 12, 2015 at 1:40 AM, avinash D'silva <>
wrote:

> loop(Socket) ->
> case gen_tcp:recv(Socket, 0) of
> {ok, Data} ->
> gen_tcp:send(Socket, string:to_upper(Data)),
> loop(Socket);
> {error, closed} ->
> ok
> end.
>
> I get an error for string:to_upper()
>
> I am trying to create a simple echo server that converts text to upper
> case.
>
> original code: http://20bits.com/article/network-programming-in-erlang/
>
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150712/c7845925/attachment.html>


More information about the erlang-questions mailing list