[Twisted-Python] Re: 111: Connection refused

Damon Fasching damon.fasching at sbcglobal.net
Thu Aug 5 16:59:09 MDT 2004


I've made a few more checks regarding my connection
refused error.

> Well, it depends on what the problem is, and we
> don't know that.  It also depends on what your PB
> server actually is; there's not really any such
thing > as a plain "PB server"; that doesn't really
tell us
> anything about what it is or how it should run. 
> application is this PB server?  Is it run by twistd
> (and if so, from a tap or a tac)?  Or is it a script
> that calls reactor.run() directly?  Etc.

> You could also try "netstat -ntlp", and see if there

> is a process  listening on that port, and if so, is
> it listening on the right interface (probably
>, and is it the right process.

> -Andrew.

I've reproduced the problem with a very bare server
script, the following 4 lines:

from twisted.spread import pb
from twisted.internet import reactor
reactor.listenTCP(8789, pb.PBServerFactory(pb.Root()))

I have two machines, shuttle-1 and shuttle-2.  I have
no problem on shuttle-1, I get the "Connection
refused" error on shuttle-2.

Before starting the server, "telnet localhost 8789",
"telnet shuttle-1 8789" and "telnet shuttle-2 8789"
all fail with the following messge, as expected, from
either machine.

Trying <ip add>...
telnet: connect to address <ip add>: Connection

After starting the server on both machines,

~ telnet localhost 8789

works on both machines, and

~ telnet shuttle-1 8789

works from shuttle-2, but 

~ telnet shuttle-2 8789

from shuttle-1 fails with the Connection refused

In addition, after starting the server, the following
line is added to the output of "netstat -ntlp" on both

tcp        0      0  * 
             LISTEN      4040/python

modulo the PID.

Is there somewhere else to look?

Also, perhaps someone can suggest a terse introduction
to Linux networking.


More information about the Twisted-Python mailing list