1

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    0.0.0.0:9000           mgibson-dev:0          LISTENING
  TCP    0.0.0.0:9002           mgibson-dev:0          LISTENING
  TCP    127.0.0.1:9001         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?

Mike
  • 113
  • 1
  • 5

2 Answers2

0

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 127.0.0.1? Your server app is listening on 127.0.0.1 only and probably mgibson-dev resolves to any other address, this can be a root of your problem.

Alex
  • 7,789
  • 4
  • 36
  • 51
0
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.

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