summaryrefslogtreecommitdiffstats
path: root/man7/tcp.7
diff options
context:
space:
mode:
Diffstat (limited to 'man7/tcp.7')
-rw-r--r--man7/tcp.7136
1 files changed, 68 insertions, 68 deletions
diff --git a/man7/tcp.7 b/man7/tcp.7
index c7b393c10..b65dd1f51 100644
--- a/man7/tcp.7
+++ b/man7/tcp.7
@@ -105,7 +105,7 @@ RFC\ 793, RFC\ 1122 and RFC\ 2001 with the NewReno and SACK
extensions.
It provides a reliable, stream-oriented,
full-duplex connection between two sockets on top of
-.BR ip (7),
+.MR ip 7 ,
for both v4 and v6 versions.
TCP guarantees that the data arrives in order and
retransmits lost packets.
@@ -116,19 +116,19 @@ TCP does not preserve record boundaries.
A newly created TCP socket has no remote or local address and is not
fully specified.
To create an outgoing TCP connection use
-.BR connect (2)
+.MR connect 2
to establish a connection to another TCP socket.
To receive new incoming connections, first
-.BR bind (2)
+.MR bind 2
the socket to a local address and port and then call
-.BR listen (2)
+.MR listen 2
to put the socket into the listening state.
After that a new socket for each incoming connection can be accepted using
-.BR accept (2).
+.MR accept 2 .
A socket which has had
-.BR accept (2)
+.MR accept 2
or
-.BR connect (2)
+.MR connect 2
successfully called on it is fully specified and may transmit data.
Data cannot be transmitted on listening or not yet connected sockets.
.P
@@ -149,7 +149,7 @@ files, or on individual sockets by using the
and
.B SO_RCVBUF
socket options with the
-.BR setsockopt (2)
+.MR setsockopt 2
call.
.P
The maximum sizes for socket buffers declared via the
@@ -163,11 +163,11 @@ and
files.
Note that TCP actually allocates twice the size of
the buffer requested in the
-.BR setsockopt (2)
+.MR setsockopt 2
call, and so a succeeding
-.BR getsockopt (2)
+.MR getsockopt 2
call will not return the same size of buffer as requested in the
-.BR setsockopt (2)
+.MR setsockopt 2
call.
TCP uses the extra space for administrative purposes and internal
kernel structures, and the
@@ -175,12 +175,12 @@ kernel structures, and the
file values reflect the
larger sizes compared to the actual TCP windows.
On individual connections, the socket buffer size must be set prior to the
-.BR listen (2)
+.MR listen 2
or
-.BR connect (2)
+.MR connect 2
calls in order to have it take effect.
See
-.BR socket (7)
+.MR socket 7
for more information.
.P
TCP supports urgent data.
@@ -190,7 +190,7 @@ stream and that it should be processed as soon as possible.
To send urgent data specify the
.B MSG_OOB
option to
-.BR send (2).
+.MR send 2 .
When urgent data is received, the kernel sends a
.B SIGURG
signal to the process or process group that has been set as the
@@ -199,7 +199,7 @@ socket "owner" using the
or
.B FIOSETOWN
ioctls (or the POSIX.1-specified
-.BR fcntl (2)
+.MR fcntl 2
.B F_SETOWN
operation).
When the
@@ -211,12 +211,12 @@ ioctl described below),
otherwise it can be received only when the
.B MSG_OOB
flag is set for
-.BR recv (2)
+.MR recv 2
or
-.BR recvmsg (2).
+.MR recvmsg 2 .
.P
When out-of-band data is present,
-.BR select (2)
+.MR select 2
indicates the file descriptor as having an exceptional condition and
.I poll (2)
indicates a
@@ -226,15 +226,15 @@ event.
Linux 2.4 introduced a number of changes for improved
throughput and scaling, as well as enhanced functionality.
Some of these features include support for zero-copy
-.BR sendfile (2),
+.MR sendfile 2 ,
Explicit Congestion Notification, new
management of TIME_WAIT sockets, keep-alive socket options
and support for Duplicate SACK extensions.
.SS Address formats
TCP is built on top of IP (see
-.BR ip (7)).
+.MR ip 7 ).
The address formats defined by
-.BR ip (7)
+.MR ip 7
apply to TCP.
TCP supports point-to-point communication only;
broadcasting and multicasting are not
@@ -245,7 +245,7 @@ System-wide TCP parameter settings can be accessed by files in the directory
In addition, most IP
.I /proc
interfaces also apply to TCP; see
-.BR ip (7).
+.MR ip 7 .
Variables described as
.I Boolean
take an integer value, with a nonzero value ("true") meaning that
@@ -335,9 +335,9 @@ The default value for this list is "reno" plus the default setting of
.\" Text heavily based on Documentation/networking/ip-sysctl.txt
If this option is enabled, the kernel tries to coalesce small writes
(from consecutive
-.BR write (2)
+.MR write 2
and
-.BR sendmsg (2)
+.MR sendmsg 2
calls) as much as possible,
in order to decrease the total number of sent packets.
Coalescing is done if at least one prior packet for the flow
@@ -1052,9 +1052,9 @@ If disabled, assume that the remote TCP is not broken even if we do
not receive a window scaling option from it.
.SS Socket options
To set or get a TCP socket option, call
-.BR getsockopt (2)
+.MR getsockopt 2
to read or
-.BR setsockopt (2)
+.MR setsockopt 2
to write the option with the option level argument set to
.BR IPPROTO_TCP .
Unless otherwise noted,
@@ -1067,12 +1067,12 @@ most
.B IPPROTO_IP
socket options are valid on TCP sockets.
For more information see
-.BR ip (7).
+.MR ip 7 .
.P
Following is a list of TCP-specific socket options.
For details of some other socket options that are also applicable
for TCP sockets, see
-.BR socket (7).
+.MR socket 7 .
.TP
.BR TCP_CONGESTION " (since Linux 2.6.13)"
.\" commit 5f8ef48d240963093451bcf83df89f1a1364f51d
@@ -1095,7 +1095,7 @@ above).
If set, don't send out partial frames.
All queued partial frames are sent when the option is cleared again.
This is useful for prepending headers before calling
-.BR sendfile (2),
+.MR sendfile 2 ,
or for throughput optimization.
As currently implemented, there is a 200 millisecond ceiling on the time
for which output is corked by
@@ -1151,7 +1151,7 @@ This option can be used to override the system-wide setting in the file
.I /proc/sys/net/ipv4/tcp_fin_timeout
for this socket.
This is not to be confused with the
-.BR socket (7)
+.MR socket 7
level option
.BR SO_LINGER .
This option should not be used in code intended to be portable.
@@ -1245,7 +1245,7 @@ The option has no effect on when TCP retransmits a packet,
nor when a keepalive probe is sent.
.IP
This option, like many others, will be inherited by the socket returned by
-.BR accept (2),
+.MR accept 2 ,
if it was set on the listening socket.
.IP
Further details on the user timeout feature can be found in
@@ -1262,14 +1262,14 @@ portable.
This option enables Fast Open (RFC\~7413) on the listener socket.
The value specifies the maximum length of pending SYNs
(similar to the backlog argument in
-.BR listen (2)).
+.MR listen 2 ).
Once enabled,
the listener socket grants the TCP Fast Open cookie
on incoming SYN with TCP Fast Open option.
.IP
More importantly it accepts the data in SYN with a valid Fast Open cookie
and responds SYN-ACK acknowledging both the data and the SYN sequence.
-.BR accept (2)
+.MR accept 2
returns a socket that is available for read and write
when the handshake has not completed yet.
Thus the data exchange can commence before the handshake completes.
@@ -1278,7 +1278,7 @@ This option requires enabling the server-side support on sysctl
(see above).
For TCP Fast Open client-side support,
see
-.BR send (2)
+.MR send 2
.B MSG_FASTOPEN
or
.B TCP_FASTOPEN_CONNECT
@@ -1288,23 +1288,23 @@ below.
This option enables an alternative way to perform Fast Open
on the active side (client).
When this option is enabled,
-.BR connect (2)
+.MR connect 2
would behave differently depending on
if a Fast Open cookie is available for the destination.
.IP
If a cookie is not available (i.e. first contact to the destination),
-.BR connect (2)
+.MR connect 2
behaves as usual by sending a SYN immediately,
except the SYN would include an empty Fast Open cookie option
to solicit a cookie.
.IP
If a cookie is available,
-.BR connect (2)
+.MR connect 2
would return 0 immediately but the SYN transmission is deferred.
A subsequent
-.BR write (2)
+.MR write 2
or
-.BR sendmsg (2)
+.MR sendmsg 2
would trigger a SYN with data plus cookie in the Fast Open option.
In other words,
the actual connect operation is deferred until data is supplied.
@@ -1316,30 +1316,30 @@ different
.I errno
values.
With cookie present,
-.BR write (2)
+.MR write 2
or
-.BR sendmsg (2)
+.MR sendmsg 2
must be called right after
-.BR connect (2)
+.MR connect 2
in order to send out SYN+data to complete 3WHS and establish connection.
Calling
-.BR read (2)
+.MR read 2
right after
-.BR connect (2)
+.MR connect 2
without
-.BR write (2)
+.MR write 2
will cause the blocking socket to be blocked forever.
.IP
The application should either set
.B TCP_FASTOPEN_CONNECT
socket option before
-.BR write (2)
+.MR write 2
or
-.BR sendmsg (2),
+.MR sendmsg 2 ,
or call
-.BR write (2)
+.MR write 2
or
-.BR sendmsg (2)
+.MR sendmsg 2
with
.B MSG_FASTOPEN
flag directly,
@@ -1377,7 +1377,7 @@ It can be changed via
.IR /proc/sys/net/ipv4/tcp_stdurg .
.P
It is possible to peek at out-of-band data using the
-.BR recv (2)
+.MR recv 2
.B MSG_PEEK
flag.
.P
@@ -1386,9 +1386,9 @@ Since Linux 2.4, Linux supports the use of
in the
.I flags
argument of
-.BR recv (2)
+.MR recv 2
(and
-.BR recvmsg (2)).
+.MR recvmsg 2 ).
This flag causes the received bytes of data to be discarded,
rather than passed back in a caller-supplied buffer.
Since Linux 2.4.4,
@@ -1398,7 +1398,7 @@ also has this effect when used in conjunction with
to receive out-of-band data.
.SS Ioctls
The following
-.BR ioctl (2)
+.MR ioctl 2
calls return information in
.IR value .
The correct syntax is:
@@ -1452,7 +1452,7 @@ flag).
.IP
Note that a read never reads across the urgent mark.
If an application is informed of the presence of urgent data via
-.BR select (2)
+.MR select 2
(using the
.I exceptfds
argument) or through delivery of a
@@ -1511,11 +1511,11 @@ executed on a shut down socket.
The other end didn't acknowledge retransmitted data after some time.
.P
Any errors defined for
-.BR ip (7)
+.MR ip 7
or the generic socket layer may also be returned for TCP.
.SH VERSIONS
Support for Explicit Congestion Notification, zero-copy
-.BR sendfile (2),
+.MR sendfile 2 ,
reordering support and some SACK extensions
(DSACK) were introduced in Linux 2.4.
Support for forward acknowledgement (FACK), TIME_WAIT recycling,
@@ -1533,17 +1533,17 @@ IPv6 is not described.
.\" Alexey Kuznetsov's Documentation/networking/ip-sysctl.txt
.\" document.
.SH SEE ALSO
-.BR accept (2),
-.BR bind (2),
-.BR connect (2),
-.BR getsockopt (2),
-.BR listen (2),
-.BR recvmsg (2),
-.BR sendfile (2),
-.BR sendmsg (2),
-.BR socket (2),
-.BR ip (7),
-.BR socket (7)
+.MR accept 2 ,
+.MR bind 2 ,
+.MR connect 2 ,
+.MR getsockopt 2 ,
+.MR listen 2 ,
+.MR recvmsg 2 ,
+.MR sendfile 2 ,
+.MR sendmsg 2 ,
+.MR socket 2 ,
+.MR ip 7 ,
+.MR socket 7
.P
The kernel source file
.IR Documentation/networking/ip\-sysctl.txt .