socket.connect() hangs in SYN_SENT state.

I'm having an issue where my program hangs while doing
socket.connect() for a couple minutes, then times out the connection
and crashes. I'm connecting to an apache2 process on the same machine,
for testing. When looking at netstat, the socket is in the SYN_SENT
state, like this:

$netstat -a -tcp
tcp 0 0 *:www *:*
LISTEN 7635/apache2
tcp 0 1 bukzor:38234 adsl-75-61-84-249.d:www
SYN_SENT 9139/python

Anyone know a general reason this might happen? Even better, a way to
fix it?

Doing a minimal amount of research, I found this in the netstat
The state SYN_SENT means that an application has made arequest for a
TCP session, but has not yet received the return SYN+ACK packet.

This would indicate it's a server issue, but it seems very stable when
I look at it via a browser.

Here's the server. If you browse to it, it documents the exported

Here's my test client that's hanging. Turn 'verbose' to True to get
more debugging info.

#!/usr/bin/env python
from xmlrpclib import ServerProxy

s = ServerProxy("";,

print s.helloworld()
print s.add(1,2)
print s.subtract(1,2)


Relevant Pages

  • Re: read() returns ETIMEDOUT
    ... Server has around 5 MB/s almost constant rx/tx rate. ... connection on average) but it was a stable ... other load on the server the connection is not broken by the server. ... netstat -m before and after the ...
  • Re: What is going on with my Dialup?
    ... connection, ... box between me and the modem with all ports except 80 and 441 closed. ... those are closed to _inbound_ packets (or are you running a web server ... out what ('netstat' will tell you that) and why. ...
  • Re: What should Netstat show?
    ... Not sure what you think netstat should show you. ... ipconfig/all from the server please and one from a client? ... > assuming to mean that the entire internet connection is dropping. ...
  • Re: [PATCH 0/4] 2.6.21-rc7 NFS writes: fix a series of issues
    ... indicate that the connection to the server is down. ... The netstat outputs are stable: ...
  • Re: Outgoing POP3 email missing/lost/not received
    ... Funny thing is that I have had this ISP for 8 years and it has always been ... It looks like when you last ran CEICW, you set the ISP's mail server to: ... Internet Connection Wizard. ... After the wizard completes, the following network connection ...