Port 5040 · TCP

Port 5040: Connected Devices Platform

The Connected Devices Platform behind cross-device features such as Nearby sharing and Phone Link.

Protocol
TCP
On Windows
svchost.exe (Connected Devices Platform Service, CDPSvc)
Risk if open to the internet
Low

Seeing it on your PC

svchost.exe listening on 5040 is normal on Windows 10 and 11.

Should you block it?

Nothing outside your PC needs to reach it from the internet. Leave the service running if you use phone or cross-device features.

Check it on your PC

Run this in PowerShell to see what is using port 5040 right now, and which program owns it:

Get-NetTCPConnection -LocalPort 5040 -ErrorAction SilentlyContinue | Select-Object LocalAddress,LocalPort,RemoteAddress,RemotePort,State,@{n='Process';e={(Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue).ProcessName}}

No output means nothing is using the port at the moment. For every connection at once, paste netstat -ano into the netstat explainer.

Block it in Windows Firewall

In PowerShell run as administrator, this stops other computers from connecting to this port on your PC. It does not stop your own programs connecting out.

New-NetFirewallRule -DisplayName "Block inbound TCP 5040" -Direction Inbound -Protocol TCP -LocalPort 5040 -Action Block

Undo it with Remove-NetFirewallRule -DisplayName "Block inbound …", using the same name. If you depend on the service on your local network, this rule stops that too.