[erlang-questions] strange behaviour of gen_tcp:connect
Bengt Kleberg
bengt.kleberg@REDACTED
Tue Apr 7 12:24:41 CEST 2009
Greetings,
It is likely that deep down inside the Erlang VM the gen_tcp:connect is
performed by the C library call connect. This C call is blocking and can
return a timeout error.
What do you get if you directly (in a C program) call connect with the
arguments you have given to gen_tcp:connect?
bengt
On Tue, 2009-04-07 at 11:13 +0200, Gamoto wrote:
> I an windows server 2003. I don't understand why gen_tcp:connect returns ALWAYS an error.
> "connect" should be blocking, the port is free, I didn't precise a timeout. I also tried with "localhost".
> Another strange effect: error returned is "econnrefused" or, when another emacs is opened with erlang code inside, the returned error is "timeout" !!!
> Is it "normal" with Erlang ?
>
> John
>
> start()->
> case gen_tcp:connect("127.0.0.1",1688,[binary, {packet, 0}]) of
> {ok,Socket}->
> io:format("Socket established~n"),
> loop(Socket);
> {error,Reason}->
> io:format("Error on connect: ~s~n",[Reason])
> end.
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list