<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NetworkExtension",
  "identifier" : "/documentation/NetworkExtension/NETunnelProviderSession",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Network Extension"
    ],
    "preciseIdentifier" : "c:objc(cs)NETunnelProviderSession"
  },
  "title" : "NETunnelProviderSession"
}
-->

# NETunnelProviderSession

An object to start and stop a tunnel connection and get its status.

```
class NETunnelProviderSession
```

## Overview

`NETunnelProviderSession` objects control network tunnel connections provided by Tunnel Provider extensions.

`NETunnelProviderSession` objects are not instantiated directly. Instead, each [`NETunnelProviderManager`](/documentation/NetworkExtension/NETunnelProviderManager) object has an associated `NETunnelProviderSession` as a read-only property.

## Topics

### Controlling the tunnel connection

[`-  startTunnelWithOptions:andReturnError:`](/documentation/NetworkExtension/NETunnelProviderSession/startTunnel(options:))

Start the process of connecting the tunnel.

[`-  stopTunnel`](/documentation/NetworkExtension/NETunnelProviderSession/stopTunnel())

Start the process of disconnecting the tunnel.

### Communicating with the tunnel provider

[`-  sendProviderMessage:returnError:responseHandler:`](/documentation/NetworkExtension/NETunnelProviderSession/sendProviderMessage(_:responseHandler:))

Send a message to the Tunnel Provider extension. If the extension is not running, it should be launched to handle the message. If this method can’t start sending the message it reports an error in the `returnError` parameter. If an error occurs while sending the message or returning the result, `nil` should be sent to the response handler as notification.

## Relationships

### Inherits From

[`NEVPNConnection`](/documentation/NetworkExtension/NEVPNConnection)

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

---

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)