---
title: maximumDatagramLength
framework: networkextension
role: symbol
role_heading: Instance Property
path: networkextension/nwudpsession/maximumdatagramlength
---

# maximumDatagramLength

The maximum size of a datagram to be written currently.

## Declaration

```swift
var maximumDatagramLength: Int { get }
```

## Discussion

Discussion If a datagram is written with a longer length than maximumDatagramLength, the datagram may be fragmented or encounter an error. Note that this value is not guaranteed to be the maximum datagram length for end-to-end communication across the network. Use Key-Value Observing to watch this property.

## See Also

### Transferring data

- [setReadHandler(_:maxDatagrams:)](networkextension/nwudpsession/setreadhandler(_:maxdatagrams:).md)
- [writeDatagram(_:completionHandler:)](networkextension/nwudpsession/writedatagram(_:completionhandler:).md)
- [writeMultipleDatagrams(_:completionHandler:)](networkextension/nwudpsession/writemultipledatagrams(_:completionhandler:).md)
