[erlang-questions] gen_tcp two way comm

Konstantin Tcepliaev f355@REDACTED
Sun Oct 21 02:12:41 CEST 2012


Hi Roberto,

I suppose you forgot {active, false} in connect options.

Regards,
-- 
Konstantin


21.10.2012, 04:00, "Roberto Ostinelli" <roberto@REDACTED>:
> 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.



More information about the erlang-questions mailing list