---
title: SetDataLength
framework: networkingdriverkit
role: symbol
role_heading: Instance Method
path: networkingdriverkit/iousernetworkpacket/setdatalength-788b
---

# SetDataLength

Changes the number of bytes of data in the packet to the specified value.

## Declaration

```occ
virtual kern_return_t SetDataLength(uint32_t length);
```

## Parameters

- `length`: The new data length value, specified in bytes.

## Return Value

Return Value kIOReturnSuccess on success, or another value if an error occurred.

## See Also

### Configuring the Packet State Information

- [SetHeadroom](networkingdriverkit/iousernetworkpacket/setheadroom.md)
- [SetLinkHeaderLength](networkingdriverkit/iousernetworkpacket/setlinkheaderlength-9fqmg.md)
- [SetDataOffset](networkingdriverkit/iousernetworkpacket/setdataoffset-16kx3.md)
