[Twisted-Python] Re: Porting my Win32 Twisted to Linux Twisted

Marcin Kasperski Marcin.Kasperski at softax.com.pl
Wed Nov 14 04:51:59 EST 2007

> When I run System>Network Tools>Portscan on localhost, I can see port
> 7001 is open with a service called 'afs3-callback'.

This is somewhat misleading and does not matter anything. Simply, you
have in your /etc/services the info that port 7001 is typically used
by afs3-callback (whatever it is). Similarly the same program will
say that you are using service 'www' if port 80 is open. This is
just popular convention applied by many programs - instead of showing
numerical port, show text assigned to this port in /etc/services.

To truly check what is running on given port, try sth like

   sudo netstat -l --tcp -p

(there surely is some GUI which does the same, but I am not expert in
GUIs, learned command lines before they existed ;-))

You will get the list of all processess listening on TCP ports. In
particular you may see lines like

tcp        0      0 *:4433                  *:*                     LISTEN     26164/apache

(this is from my host, on port 4433 there is some apache process
runing, pid of the process is 26164). To check in more detail what
process do you see, try sth like

   ps 26164

(giving the pid from the line above) and you will see the command
which spawned the process. Of course you can also search for this
pid in some GUI process monitor.

Some alternative way to check some ports is to ... telnet there.
For example

   telnet localhost 7001

You get direct connection to the other side. It may give you some info
(many daemons send some initial string), or ... not. But in particular
it will tell you whether there is any process on the other side (if
not, you get 'Connection refused' error). To leave such session press
Ctrl-] and enter 'quit' after 'telnet>' prompt.

> The odd thing is, once I have run the Portscan, my client suddenly
> sees the server and connects!
> (...)
> Why does Portscan seem to open the port for me?

The only reasonable guess I can make is that your server misbehaves
somehow, for example incorrectly handles some initial connection(s).
Portscan opens connection to it and closes it, maybe it helps your

Another guess is that maybe you just missed something. For example,
maybe your server works when accessed as localhost but does not work
when accesssed on yourmachinetrueinterface (or reverse)...

If you need to diagnose your network communication in more detail,
you may take a look at wireshark (formerly ethereal) package,
it lets you capture and review the whole network communication.

| Marcin Kasperski   | Working overtime sucks the spirit and
| http://mekk.waw.pl |   motivation out of a team. (Wells)
|                    |

More information about the Twisted-Python mailing list