---
name: "IP_TOS"
section: "2const"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/IP_TOS"
---

# IP\_TOS(2const)

type of service

## NAME

IP\_TOS - type of service

## LIBRARY

Standard C library (*libc*, *-lc*)

## SYNOPSIS

```
#include <netinet/in.h>  /* Definition of IP* constants */
#include <sys/socket.h>
```

**int setsockopt(int** *sockfd***, IPPROTO\_IP, IP\_TOS,**                **const int \****tos***, sizeof(int));** **int getsockopt(int** *sockfd***, IPPROTO\_IP, IP\_TOS,**                **int \****tos***, sizeof(int));**

## DESCRIPTION

Set or receive the Type-Of-Service (TOS) field that is sent with every IP packet originating from this socket. It is used to prioritize packets on the network.

There are some standard TOS flags defined:

- **IPTOS\_LOWDELAY**

  to minimize delays for interactive traffic,

- **IPTOS\_THROUGHPUT**

  to optimize throughput,

- **IPTOS\_RELIABILITY**

  to optimize for reliability,

- **IPTOS\_MINCOST**

  should be used for "filler data" where slow transmission doesn't matter.

At most one of these TOS values can be specified. Other bits are invalid and shall be cleared.

Linux sends **IPTOS\_LOWDELAY** datagrams first by default, but the exact behavior depends on the configured queueing discipline.

Some high-priority levels may require superuser privileges (the **CAP\_NET\_ADMIN** capability).

## ERRORS

See [**IPPROTO\_IP**(2const)](/IPPROTO_IP/2const.md). See [**setsockopt**(2)](/setsockopt/2.md). See [**ip**(7)](/ip/7.md).

## HISTORY

Linux 1.0.

## SEE ALSO

[**IPPROTO\_IP**(2const)](/IPPROTO_IP/2const.md), [**setsockopt**(2)](/setsockopt/2.md), [**ip**(7)](/ip/7.md)
