[erlang-questions] gen_tcp two way comm

Roberto Ostinelli roberto@REDACTED
Sun Oct 21 02:08:21 CEST 2012


In case someone wonders, just add the {active, false} option to inet and
you're good.

I thought that was the default behaviour.

r.

On Sat, Oct 20, 2012 at 5:00 PM, Roberto Ostinelli <roberto@REDACTED>wrote:

> Hi list,
>
> this should be simple but I don't get what is going on.
>
> On a server:
>
> [...listening and connection...]
> {ok, Data} = gen_tcp:recv(Socket, 0),
> ok = gen_tcp:send(Socket,<<"some response">>).
>
> Data received from client (see below) is correctly <<"some data">>.
>
> On the client:
>
> {ok, Socket} = gen_tcp:connect("localhost", 8500, [binary, {packet, raw}]),
> ok = gen_tcp:send(Socket, <<"some data">>),
> gen_tcp:recv(Socket,0).
>
> Instead of {ok, <<"some response">>}, the last line returns {error,einval}
> .
>
> Anywhere I should start looking?..
>
> Thank you,
>
> r.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121020/df2ec509/attachment.htm>


More information about the erlang-questions mailing list