I'm migrating a client / server application from Linux to Windows and while the Linux version of the server works fine, the Windows version won't connect via localhost. While the program is trying to negotiate the connection I see the following from netstat -a (irrelevant lines omitted).

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP           mgibson-dev:0          LISTENING
  TCP           mgibson-dev:0          LISTENING
  TCP         mgibson-dev:0          LISTENING
  TCP    [::1]:52403            mgibson-dev:9001       SYN_SENT
  TCP    [::1]:52404            mgibson-dev:9001       SYN_SENT

It seems that the server is trying to respond over IPv6. Is this normal and should it work? Am I looking at the problem or just a red herring?

  • Is mgibson-dev local or remote? Can you run nestat -an or netstat -an -p tcp? – Gerald Combs Feb 9 '11 at 20:12
TCP    [::1]:52404            mgibson-dev:9001       SYN_SENT

This line seems to imply that you've tried to initiate an ipv6 connection to 'mgibson-dev' on port 9001. The SYN_SENT bit means that you've fired off a TCP SYN packet but not heard a response back.

If you're not listening on an ipv6 localhost address on TCP 9001, my initial guess would be that you have a firewall somewhere that's dropping the return packet somewhere. Normally, if the port's closed, you would expect a RST packet back, and then it would know the port isn't open and would try the ipv4 address. Because the RST packet's not coming through, it just hangs waiting for a response and eventually will time out.

In short, check your firewall to allow all inbound from localhost on both ipv4 and ipv6.

  • I was trying to connect to localhost, which was resolving to the ipv6 address I guess. Changing to fixed it. The server was binding only to, not the ipv6 address. – Mike Feb 9 '11 at 22:02

Well, the server was not trying to respond, SYN_SENT was a connection initiation state, so it was a client. It looks like the client was unable to get anything back from the mgibson-dev host. Are you sure mgibson-dev resolves to Your server app is listening on only and probably mgibson-dev resolves to any other address, this can be a root of your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.