---
title: cancel()
framework: networkextension
role: symbol
role_heading: Instance Method
path: networkextension/nwtcpconnection/cancel()
---

# cancel()

Cancel the connection.

## Declaration

```swift
func cancel()
```

## Discussion

Discussion This will clean up the resources associated with this object and transition this object to the NWTCPConnectionStateCancelled state.
