<!--
{
  "availability" : [
    "iOS: 9.0.0 - 18.0.0",
    "iPadOS: 9.0.0 - 18.0.0",
    "macCatalyst: 13.1.0 - 18.0.0",
    "visionOS: 1.0.0 - 2.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "NetworkExtension",
  "identifier" : "/documentation/NetworkExtension/NEHotspotHelperCommand/createTCPConnection(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Network Extension"
    ],
    "preciseIdentifier" : "c:objc(cs)NEHotspotHelperCommand(im)createTCPConnection:"
  },
  "title" : "createTCPConnection(_:)"
}
-->

# createTCPConnection(_:)

Create a new TCP connection over the network associated with the command.

```
func createTCPConnection(_ endpoint: NWEndpoint) -> NWTCPConnection
```

## Parameters

`endpoint`

The remote host and port of the connection.

## Return Value

A TCP connection that will connect over the network associated with the command.

## Discussion

The TCP connection is started automatically. Use KVO to observe the connection’s `state` property to be notified when the connection is established or fails.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)