<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Network",
  "identifier" : "/documentation/Network/nw_tcp_set_max_pacing_rate(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Network"
    ],
    "preciseIdentifier" : "c:@F@nw_tcp_set_max_pacing_rate"
  },
  "title" : "nw_tcp_set_max_pacing_rate(_:_:)"
}
-->

# nw_tcp_set_max_pacing_rate(_:_:)

```
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
(e.g. obtained via nw_connection_access_established_protocol_metadata).

`max_pacing_rate`

Maximum pacing rate in bytes per second. 0 or UINT64_MAX disables
pacing on this connection.

## Return Value

Returns 0 on success, or a POSIX errno value on failure (e.g. EINVAL
if metadata is not a TCP metadata object, or the underlying socket
error).

## Discussion

\abstract Set a maximum pacing rate for a TCP connection, in bytes per second.
\discussion TCP pacing spreads outgoing packet transmission across time to avoid
bursts and reduce queueing in the network. With a cap in place, the
on-wire rate is the minimum of (a) this cap, and (b) the rate computed
from the congestion window divided by smoothed RTT. The cap therefore
never raises throughput above what congestion control would otherwise
allow.

```
A value of 0 or UINT64_MAX disables pacing on this connection — the
connection sends without pacing (subject only to congestion control).

Rates in the open interval (0, 12500) are silently clamped up to
12500 bytes/second (100 Kbps). Callers needing genuinely sub-100-Kbps
pacing must shape at the application layer.

The cap may be updated at any time during the lifetime of an
established connection. Each call replaces the prior value.
```

---

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)