econnrefused on gen_tcp:connect

Alexey Romanov <>
Tue Feb 1 13:36:21 CET 2011

I am getting {error,econnrefused} on any call to gen_tcp:connect even
though 1) epmd is running and epmd -names returns the correct result;
2) ping works fine.

# HOME=/mware/cookie erts-5.8.1/bin/erl -sname aname
Eshell V5.8.1  (abort with ^G)
()1> gen_tcp:connect("localhost", 1234, []).

Same result for {127,0,0,1}, other computers on the network, etc.

# /mware/erts-5.8.1/bin/epmd -names
epmd: up and running on port 4369 with data:
name aname at port 34272

# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:90:A9:94:BD:BD
          inet addr:  Bcast:  Mask:
          RX packets:10257 errors:1 dropped:0 overruns:0 frame:1
          TX packets:4480 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:256
          RX bytes:9303332 (8.8 MiB)  TX bytes:671790 (656.0 KiB)

lo        Link encap:Local Loopback
          inet addr:  Mask:
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4900 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4900 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:331668 (323.8 KiB)  TX bytes:331668 (323.8 KiB)

# ping
PING ( 56 data bytes
64 bytes from seq=0 ttl=64 time=0.342 ms
64 bytes from seq=1 ttl=64 time=0.254 ms

What could be the reason?

Yours, Alexey Romanov

More information about the erlang-questions mailing list