---
title: NWTCPConnection
framework: networkextension
role: symbol
role_heading: Class
path: networkextension/nwtcpconnection
---

# NWTCPConnection

An object to manage a TCP connection, with or without TLS.

## Declaration

```swift
class NWTCPConnection
```

## Topics

### Monitoring the connection status

- [state](networkextension/nwtcpconnection/state.md)
- [NWTCPConnectionState](networkextension/nwtcpconnectionstate.md)
- [isViable](networkextension/nwtcpconnection/isviable.md)
- [error](networkextension/nwtcpconnection/error.md)

### Transferring data

- [readMinimumLength(_:maximumLength:completionHandler:)](networkextension/nwtcpconnection/readminimumlength(_:maximumlength:completionhandler:).md)
- [readLength(_:completionHandler:)](networkextension/nwtcpconnection/readlength(_:completionhandler:).md)
- [write(_:completionHandler:)](networkextension/nwtcpconnection/write(_:completionhandler:).md)
- [writeClose()](networkextension/nwtcpconnection/writeclose().md)

### Canceling the connection

- [cancel()](networkextension/nwtcpconnection/cancel().md)

### Responding to network changes

- [hasBetterPath](networkextension/nwtcpconnection/hasbetterpath.md)
- [init(upgradeFor:)](networkextension/nwtcpconnection/init(upgradefor:).md)

### Getting connection properties

- [endpoint](networkextension/nwtcpconnection/endpoint.md)
- [localAddress](networkextension/nwtcpconnection/localaddress.md)
- [remoteAddress](networkextension/nwtcpconnection/remoteaddress.md)
- [connectedPath](networkextension/nwtcpconnection/connectedpath.md)
- [txtRecord](networkextension/nwtcpconnection/txtrecord.md)

### Initializers

- [init(upgradeForConnection:)](networkextension/nwtcpconnection/init(upgradeforconnection:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### TCP connections

- [NWTLSParameters](networkextension/nwtlsparameters.md)
- [NWTCPConnectionAuthenticationDelegate](networkextension/nwtcpconnectionauthenticationdelegate.md)
