---
title: "createTCPConnection(_:)"
framework: networkextension
role: symbol
role_heading: Instance Method
path: "networkextension/nehotspothelpercommand/createtcpconnection(_:)"
---

# createTCPConnection(_:)

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

## Declaration

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

## Parameters

- `endpoint`: The remote host and port of the connection.

## Return Value

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

## Discussion

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.

## See Also

### Networking on the hotspot network

- [bind(to:)](foundation/nsmutableurlrequest/bind(to:).md)
- [createUDPSession(_:)](networkextension/nehotspothelpercommand/createudpsession(_:).md)
