Troubleshooting
TCP client gets no SYN-ACK from a Windows PC server: firewall causes
Short answer
When a SYN reaches the Windows PC but no SYN-ACK comes back, and other clients connect to the same server, the host firewall is dropping that source. A leftover block rule beats any allow rule, and an allow rule scoped to Domain or Private does nothing on a Public adapter. Delete the old rules, add one inbound TCP allow rule for the server port on the active profile, and confirm the SYN-ACK in a capture.

On this page
If an edge controller's TCP client sends a SYN to a server listening on a Windows PC and gets back nothing but its own retransmissions, while clients on other machines connect to the same server without trouble, Windows Defender Firewall on the PC is dropping that connection. In most cases the cause is a leftover inbound block rule from early testing, because a block rule overrides every allow rule. The other common cause is an allow rule scoped to a network profile that the controller-facing adapter isn't using. Delete the stale rules for the server program and port. Add one inbound TCP allow rule scoped to the controller's address and the active profile. Then confirm the SYN-ACK in a capture taken on the PC.
Three clues that point at the PC's firewall #
Taken together, these observations place the fault in the PC's host firewall, not in your code and not on the controller:
- The SYN arrives at the PC. A capture tool on the PC sees packets at the adapter, below the firewall. A SYN in the capture proves the network delivered it, not that the server received it.
- A stopped server answers with a reset. With nothing listening, the PC's TCP stack replies with RST and the client reports at once that nothing is listening. So the path is good and the port number itself is not being filtered.
- A running server goes silent. Once the server program owns the listening socket, the SYN is dropped and nothing comes back. That is exactly how a rule behaves when it matches only while that program holds the port, such as a program-scoped block rule.
- Other clients succeed. A client on another machine connects to the same server. Whatever is dropping the controller is scoped by profile, adapter or remote address. A missing listener would fail every client.
If clients written in different languages all show the same pattern, the client code is cleared as well.
Firewall causes on the Windows host #
Check these in order. The first two cover most cases.
- A stale inbound block rule. The first time a program listens on a port, Windows asks whether to allow it. Dismissing or declining that prompt leaves inbound block rules for the program, often on the Public profile. As the Windows Firewall rules documentation explains, an explicit block rule takes precedence over any conflicting allow rule. A more specific allow rule wins only when no block rule matches, so a new allow rule for the port cannot beat the old block.
- An allow rule on the wrong profile. Windows assigns the Public category to networks it cannot identify: a direct cable to a controller, a switch with no gateway, or the virtual adapter behind a virtual controller. Public blocks unsolicited inbound connections by default, so an allow rule limited to Domain and Private never applies to that adapter. Clients on the office network reach the PC through a Domain or Private adapter, which is why they work.
- Shields-up on the active profile. The setting "Block all incoming connections, including those in the list of allowed apps" makes a profile ignore every inbound allow rule without deleting any of them. Outbound connections the PC starts still work. The PC can still reach the controller when the controller is the server, and that hides the setting.
- A rule pinned to the wrong source or program. An allow rule limited to a subnet that doesn't include the controller never matches. Neither does a rule tied to the executable path of an earlier build.
Evaluating the rules for a controller at 192.168.1.50 on a Public adapter #
This is a hypothetical case built from documented firewall behavior, not a measured test.
Inputs:
- Server port: TCP 5000. Microsoft's New-NetFirewallRule example uses this port, and it serves here as the example server port.
- Controller address: 192.168.1.50, an example address on a direct link to the PC.
- Adapter category: Public, because Windows cannot identify a network with no gateway (Set-NetConnectionProfile documentation).
- Rule A: inbound allow, TCP, the server port, profiles Domain and Private. This is the documented example rule.
- Rule B: inbound block for the server program on the Public profile, left behind by a dismissed first-run prompt.
The rule in words: the SYN passes only when zero block rules match and at least one allow rule matches on the active profile. Neither rule order nor specificity can rescue an allow rule from a matching block rule.
The arithmetic:
- Before the fix: matching block rules = 1 (Rule B matches the Public profile, the server program and inbound TCP). Matching allow rules = 0 (Rule A excludes Public). With 1 block match, the SYN is dropped whatever the allow count is.
- After deleting Rule B: block = 0, allow = 0. The SYN is still dropped, now by the Public profile's default inbound block.
- After setting the adapter to Private: block = 0, allow = 1 (Rule A now matches). The SYN passes and the server answers with a SYN-ACK.
Result: the fix takes two changes, not one. Deleting the block rule alone leaves the connection dead, and fixing the profile alone leaves Rule B dropping the SYN.
Decision: if the block count is 1 or more, delete or narrow those rules first, whatever allow rules exist. If the block count is 0 and the allow count is 0, fix the adapter's profile or the rule's scope. Look past the firewall only when the block count is 0 and the allow count is at least 1.
Clear the stale rules and add one scoped allow rule #
- Run
Get-NetConnectionProfileand note the alias and network category of the adapter that faces the controller. - If that adapter is a dedicated controller network showing Public, set it to Private, for example
Set-NetConnectionProfile -InterfaceAlias "Ethernet0" -NetworkCategory Privatewith your adapter's alias in place of Ethernet0. If you would rather keep it Public, include Public in the new rule's profiles. - In Windows Security, open Firewall & network protection, select the active profile and check Incoming connections. Clear the block-all box if it is ticked.
- Open wf.msc, go to Inbound Rules, and find every rule that names the server program or the server port, including the ones the first-run prompt created. Delete the block rules and the leftover allow rules from earlier tests. Don't stack a new rule on top of them.
- Add the single rule below, restart the server, and capture on the PC's adapter. Success is a SYN, SYN-ACK and ACK from the controller's address, followed by data.
The rule to add #
The netsh form carries both the profile and the remote-address scope, so the port opens to the controller only and not to every host on the network:
netsh advfirewall firewall add rule name="TCP server from controller" dir=in action=allow protocol=tcp localport=5000 remoteip=192.168.1.50 profile=private
If you kept the adapter Public, add public to the profile list. The PowerShell form in the New-NetFirewallRule cmdlet reference sets the port and profile the same way, and like any allow rule, a matching block rule still overrides it:
New-NetFirewallRule -DisplayName "Allow TCP server" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 5000 -Profile Private
Find the rule that still drops the SYN #
If the capture still shows only retransmissions, have Windows name the filter. Under Advanced Audit Policy Configuration > Object Access, enable failure auditing for Audit Filtering Platform Connection, then let the controller retry. The Security log now records event 5157 for each dropped connection. The event shows the Application Name, the Direction, the source and destination address and port, the protocol number (6 for TCP) and the Filter Run-Time ID. Run netsh wfp show filters and match that ID to a rule name. That gives you the exact rule to delete or narrow. Once the connection works, turn the failure auditing back off so the Security log doesn't fill with drops from unrelated traffic.
If no 5157 event appears while the SYN keeps arriving and the server is listening, look at whatever else on the PC filters traffic, such as the firewall in an endpoint-security product.
When the drop happens before the PC #
If the capture on the PC never shows the SYN, the PC's firewall is not the problem. Look at the controller's own firewall, its app confinement and its routing. The steps for redirecting TCP 502 to 8502 on a Linux edge controller firewall show where that kind of rule lives on the controller side. Confinement denials logged while you install a client app are worth fixing, but they are not the cause once the SYN reaches the PC.
Once the handshake completes, a different set of faults takes over. A session that opens and then carries nothing is covered under a gateway that shows a TCP connection but sends no payload. A broker that rejects the client after TCP connects is covered in diagnosing an MQTT connect that fails when TCP works.
Questions asked
Does moving my allow rule to the top of the list in wf.msc help?
No. Windows Firewall does not evaluate rules from the top of the list down, so where a rule sits in the console changes nothing. Precedence decides the result: any matching block rule drops the packet, and only then does a more specific allow rule win over a broader one, for example a rule naming a single host address over one covering a whole subnet.
Why does a client running on the same PC connect when the controller cannot?
A client on the same PC reaches its own server over the loopback path, which the inbound firewall rules do not filter. A local test proves the server is listening and the code works. It tells you nothing about the rules applied to a packet arriving on a physical or virtual adapter, so test from a second machine on the controller's network instead.
Do I need an outbound rule so the PC can send the SYN-ACK?
No. Windows Firewall is stateful. Once an inbound allow rule admits the SYN, replies on that connection go out without a separate outbound rule, and outbound traffic is allowed by default on every profile. If your site policy has changed outbound to block, also check for an outbound block rule that names the server program.
Is it acceptable to switch the firewall off to prove it is the cause?
Only briefly, and only on an isolated controller network. The cleaner test keeps the firewall on and uses the failure audit event to name the filter doing the blocking. If you do switch a profile off for a minute, turn every profile back on with netsh advfirewall set allprofiles state on, then prove the scoped allow rule works while the firewall is running.


