[Twisted-Python] multiple connectTCP bindaddress problem

Chris Laws claws at tpg.com.au
Mon Nov 8 23:25:25 EST 2004


Looks like I'm moving to "OS specified addresses" anyway, as I can't get my current impementation 
working properly.

Using the implementation where I increment the local port for each bainaddress arg to the connectTCP call, 
I was receiving "connectbinderror" on the client whenever I closed and restarted a Server. 

Interstingly I would also get this error if I started the client only (Ie. no servers running which it could 
connect to). In my logs I would see the initial connection attempt, a failure due to "connection refused". 
After a backoff time a second connection attempt would be made where again it would fail but with 
a "connectbinderror" - "address already in use". My client factory is inheriting from the 
ReconnectingClientFactory. 

Using netstat on Windows I could see the client side socket listed as "LISTENING". Is this right for a client 
side socket when not actually connected?

Anyway I guess that when the ReconnectingClientFactory attempted to perform a retry it would see the 
address as "in-use" and fail with a bind error similar to my original problem where I was trying to bind to 
an address which was already listening.

When I let the OS specify the address I don't see this problem. Surely it is performing the same functions 
though...just with OS specified IP:Port combination?

My app is working now with OS specified ports, though I would still like to understand where I was going 
wrong and why?

Chris





More information about the Twisted-Python mailing list