[erlang-questions] strange behaviour of gen_tcp:connect

Gamoto <>
Tue Apr 7 11:13:46 CEST 2009


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.




More information about the erlang-questions mailing list