IP_TOS(2const)

πŸ“¦
version 6.20 Β· 4 versions
, in arch rolling, nixpkgs unstable

πŸ’– IP_TOS β€” type of service πŸ’–

okay bestie, welcome to the IP_TOS(2const) page, she's short, she's iconic, she's the one who decides how fancy your packets get to act on the network 🌈✨

This one lives in the Standard C library (libc, -lc), just so you know where to send the vibes 🫢


✨ 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 πŸ’…

So basically, IP_TOS lets you set or receive the Type-Of-Service (TOS) field that gets sent along with every single IP packet that originates from this socket πŸ‘‘. What is it for? Prioritizing packets on the network, periodt.

There's a little roster of standard TOS flags defined for you, and honestly? They ate:

  • 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.
⚠️ okay listen up, this part is important: at most one of these TOS values can be specified. Other bits are invalid and shall be cleared. No mix-and-matching, bestie, that's not the move πŸ’€

Linux sends IPTOS_LOWDELAY datagrams first by default, but fr fr, the exact behavior depends on the configured queueing discipline. So it's giving "defaults to main character, but the queue decides the plot" πŸŽ€

Alsooo, some high-priority levels may require superuser privileges (the CAP_NET_ADMIN capability). So don't be shocked if you need the fancy permissions ✨


😭 ERRORS 😭

See IPPROTO_IP(2const). See setsockopt(2). See ip(7). (yeah she's pointing you at her friends, that's the whole section, no notes πŸ’œ)


🌸 HISTORY 🌸

  • Linux 1.0. β€” she's been here since basically forever, lowkey a legend πŸ¦‹

🧚 SEE ALSO 🧚


that's the whole page, bestie, you understood it perfectly, i'm so proud of you πŸ₯ΉπŸ’– go set some TOS bits responsibly, mwah πŸ’…βœ¨ from the Linux man-pages 6.20, dated 2025-11-25 πŸŽ€πŸ«Ά

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: Linux-man-pages-copyleft
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms