socket.connect() hangs in SYN_SENT state.

Miles semanticist at
Sun Jul 13 10:14:15 CEST 2008

On Sat, Jul 12, 2008 at 11:23 PM, bukzor <workitharder at> wrote:
> 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?

That socket connection is to a remote machine, not the same one.  Your
test code works fine for me.  The "hang then crash" (and I'm assuming
"crash" here means an uncaught exception) just means that your packets
are being silently ignored by whatever machine you're actually
attempting to connect to. It's possible that your machine has odd DNS
settings causing to resolve to the wrong address.


More information about the Python-list mailing list