<!--
{
  "documentType" : "article",
  "framework" : "Network",
  "identifier" : "/documentation/Network/tcp-options",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "TCP Options"
}
-->

# TCP Options

Configure options for connections that use the Transmission Control Protocol.

## Topics

### Creating TCP Connections

[`nw_protocol_copy_tcp_definition`](/documentation/Network/nw_protocol_copy_tcp_definition())

Accesses the system definition of the Transport Control Protocol.

[`nw_tcp_create_options`](/documentation/Network/nw_tcp_create_options())

Initializes a default set of TCP connection options.

### Customizing TCP Options

[`nw_tcp_options_set_enable_fast_open`](/documentation/Network/nw_tcp_options_set_enable_fast_open(_:_:))

Enables TCP Fast Open on a connection.

[`nw_tcp_options_set_maximum_segment_size`](/documentation/Network/nw_tcp_options_set_maximum_segment_size(_:_:))

Sets TCP’s maximum segment size in bytes.

[`nw_tcp_options_set_no_delay`](/documentation/Network/nw_tcp_options_set_no_delay(_:_:))

Disables Nagle’s algorithm for TCP.

[`nw_tcp_options_set_no_options`](/documentation/Network/nw_tcp_options_set_no_options(_:_:))

Sets TCP into no-options mode.

[`nw_tcp_options_set_no_push`](/documentation/Network/nw_tcp_options_set_no_push(_:_:))

Sets TCP into no-push mode.

[`nw_tcp_options_set_retransmit_fin_drop`](/documentation/Network/nw_tcp_options_set_retransmit_fin_drop(_:_:))

Causes TCP to drop its connection after not receiving an ACK after a FIN.

[`nw_tcp_options_set_disable_ack_stretching`](/documentation/Network/nw_tcp_options_set_disable_ack_stretching(_:_:))

Disables TCP acknowledgment stretching.

[`nw_tcp_options_set_disable_ecn`](/documentation/Network/nw_tcp_options_set_disable_ecn(_:_:))

Disables negotiation of Explicit Congestion Notification markings.

### Configuring Keepalives

[`nw_tcp_options_set_enable_keepalive`](/documentation/Network/nw_tcp_options_set_enable_keepalive(_:_:))

Enables TCP keepalives.

[`nw_tcp_options_set_keepalive_idle_time`](/documentation/Network/nw_tcp_options_set_keepalive_idle_time(_:_:))

Sets the number of seconds of idleness that TCP waits before sending keepalive probes.

[`nw_tcp_options_set_keepalive_count`](/documentation/Network/nw_tcp_options_set_keepalive_count(_:_:))

Sets the number of keepalive probes that TCP sends before terminating the connection.

[`nw_tcp_options_set_keepalive_interval`](/documentation/Network/nw_tcp_options_set_keepalive_interval(_:_:))

Sets the number of seconds that TCP waits between sending keepalive probes.

### Setting Timeouts

[`nw_tcp_options_set_connection_timeout`](/documentation/Network/nw_tcp_options_set_connection_timeout(_:_:))

Sets the number of seconds that TCP waits before timing out its handshake.

[`nw_tcp_options_set_retransmit_connection_drop_time`](/documentation/Network/nw_tcp_options_set_retransmit_connection_drop_time(_:_:))

Sets the number of seconds that TCP waits between retransmission attempts.

[`nw_tcp_options_set_persist_timeout`](/documentation/Network/nw_tcp_options_set_persist_timeout(_:_:))

Sets the TCP persist timeout in seconds, as defined by RFC 6429.

### Inspecting TCP State

[`nw_protocol_metadata_is_tcp`](/documentation/Network/nw_protocol_metadata_is_tcp(_:))

Checks whether a metadata object contains TCP connection state.

[`nw_tcp_get_available_send_buffer`](/documentation/Network/nw_tcp_get_available_send_buffer(_:))

Accesses the number of available bytes in the TCP send buffer.

[`nw_tcp_get_available_receive_buffer`](/documentation/Network/nw_tcp_get_available_receive_buffer(_:))

Accesses the number of available bytes in the TCP receive buffer.



---

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)