The problem:

My Windows 2008 Server cannot establish TCP connections with remote machines.

Steps to reproduce:

I have a service running on a Windows 2008 Server machine on port 40.000 with the ip

From another Linux machine i try using Telnet 40000

This results in a connection with the state SYN_RECEIVED.

I use netstat -a | find "40000" to see all connections and after i try telnet, i can see 2 connections

  1. A connection thats listerning on port 40000
  2. A connection in state SYN_RECEIVED

The program has been tested on other machines and another Windows 2008 machine, where it worked.

Does anoyone have any ideas whats wrong and how to modify the windows 2008 server to make it work.

  • Have you enabled inbound connections to TCP port 40000 in Windows Firewall? – Massimo Aug 26 '09 at 13:19
  • 1
    If Windows Firewall is disabled, then it's definitely not its fault. – Massimo Aug 28 '09 at 1:38

Ok, some obvious ones, but maybe they can help:

  • Does the server correctly accept other inbound connections like file sharing, remote desktop and so on?
  • Does the service accept connections from the server itself, i.e. telnet localhost 40000?
  • Is the service a .NET application? Windows Server 2008 can get a lot tricky with .NET framework sub-features.
  • Yes , it was only a problem with our service. Remote Desktop and other services worked fine. I have added a reply with the solution to the problem. – JesperGJensen Aug 28 '09 at 9:17

We have now found a solution to my problem and i wanted to share this solution.

The problem was caused by a single option on the Socket.

socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.ReuseAddress, true);

When this option was set to true, our service was unable to receive any connections from a different subnet on Windows 2008. The connection would get stuck in the TCP Handshake phase.

This was not a problem for connections from the same machine or from machines on the same subnet.

The same program installed on a Windows 2003 did not have the problem with connections from other subnets.

Your Answer

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