ExtendedSocketException encountered when calling TcpClient.ConnectAsync() from a UWP app

580 Views Asked by At

When calling TcpClient.ConnectAsync(), a ExtendedSocketException is encountered with the message "An attempt was made to access a socket in a way forbidden by its access permissions". However, connecting to the same TCP endpoint with a regular .NET app, from the same machine, and same VS solution, succeeds (thus eliminating any concern over firewall or other network issues).

1

There are 1 best solutions below

0
On

The problem was solved by adding the "Private Networks" capability to the app package: enter image description here