| 1 |
.\" Copyright, the authors of the Linux man-pages project |
| 2 |
.\" |
| 3 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 4 |
.\" |
| 5 |
.TH IP_TOS 2const 2025-11-25 "Linux man-pages 6.18" |
| 6 |
.SH NAME |
| 7 |
IP_TOS |
| 8 |
\- |
| 9 |
type of service |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.BR "#include <netinet/in.h>" " /* Definition of " IP* " constants */" |
| 16 |
.B #include <sys/socket.h> |
| 17 |
.P |
| 18 |
.BI int\~setsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_TOS, |
| 19 |
.BI " const\~int\~*" tos ,\~sizeof(int)); |
| 20 |
.BI int\~getsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_TOS, |
| 21 |
.BI " int\~*" tos ,\~sizeof(int)); |
| 22 |
.fi |
| 23 |
.SH DESCRIPTION |
| 24 |
Set or receive the Type-Of-Service (TOS) field that is sent |
| 25 |
with every IP packet originating from this socket. |
| 26 |
It is used to prioritize packets on the network. |
| 27 |
.P |
| 28 |
There are some standard TOS flags defined: |
| 29 |
.TP |
| 30 |
.B IPTOS_LOWDELAY |
| 31 |
to minimize delays for interactive traffic, |
| 32 |
.TP |
| 33 |
.B IPTOS_THROUGHPUT |
| 34 |
to optimize throughput, |
| 35 |
.TP |
| 36 |
.B IPTOS_RELIABILITY |
| 37 |
to optimize for reliability, |
| 38 |
.TP |
| 39 |
.B IPTOS_MINCOST |
| 40 |
should be used for "filler data" where slow transmission doesn't matter. |
| 41 |
.P |
| 42 |
At most one of these TOS values can be specified. |
| 43 |
Other bits are invalid and shall be cleared. |
| 44 |
.P |
| 45 |
Linux sends |
| 46 |
.B IPTOS_LOWDELAY |
| 47 |
datagrams first by default, |
| 48 |
but the exact behavior depends on the configured queueing discipline. |
| 49 |
.\" FIXME elaborate on this |
| 50 |
.P |
| 51 |
Some high-priority levels may require superuser privileges (the |
| 52 |
.B CAP_NET_ADMIN |
| 53 |
capability). |
| 54 |
.\" The priority can also be set in a protocol-independent way by the |
| 55 |
.\" .RB ( SOL_SOCKET ", " SO_PRIORITY ) |
| 56 |
.\" socket option (see |
| 57 |
.\" .BR socket (7)). |
| 58 |
.SH ERRORS |
| 59 |
See |
| 60 |
.BR IPPROTO_IP (2const). |
| 61 |
See |
| 62 |
.BR setsockopt (2). |
| 63 |
See |
| 64 |
.BR ip (7). |
| 65 |
.SH HISTORY |
| 66 |
Linux 1.0. |
| 67 |
.SH SEE ALSO |
| 68 |
.BR IPPROTO_IP (2const), |
| 69 |
.BR setsockopt (2), |
| 70 |
.BR ip (7) |