<!--
{
  "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/createUDPSession(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Network Extension"
    ],
    "preciseIdentifier" : "c:objc(cs)NEHotspotHelperCommand(im)createUDPSession:"
  },
  "title" : "createUDPSession(_:)"
}
-->

# createUDPSession(_:)

Creates a new UDP session over the network associated with the command.

```
func createUDPSession(_ endpoint: NWEndpoint) -> NWUDPSession
```

## Parameters

`endpoint`

The remote host and port of the session.

## Return Value

A UDP session that will connect over the network associated with the command.

## Discussion

The UDP session is started automatically. Use KVO to observe the session’s state property to be notified when the session is ready to send and receive UDP datagrams. For information about KVO see [Key-Value Observing Programming Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html#//apple_ref/doc/uid/10000177i).

---

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)