---
title: "nw_tcp_set_max_pacing_rate(_:_:)"
framework: network
role: symbol
role_heading: Function
path: "network/nw_tcp_set_max_pacing_rate(_:_:)"
---

# nw_tcp_set_max_pacing_rate(_:_:)

## Declaration

```swift
func nw_tcp_set_max_pacing_rate(_ metadata: nw_protocol_metadata_t, _ max_pacing_rate: UInt64) -> Int32
```

## Parameters

- `metadata`: A TCP protocol metadata object from an established connection.
- `max_pacing_rate`: Maximum pacing rate in bytes per second.

## Return Value

Return Value Returns 0 on success, or an error code on failure.

## Discussion

Discussion Set the maximum pacing rate for TCP transmission in bytes per second. TCP pacing spreads out packet transmission to avoid bursts and reduce network congestion. The actual pacing rate used will be the minimum of this value and the rate computed from cwnd/RTT. A value of 0 or UINT64_MAX means unlimited (disables pacing).
