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

# createUDPSession(_:)

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

## Declaration

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

## Parameters

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

## Return Value

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

## Discussion

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.

## See Also

### Networking on the hotspot network

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