Exploring Socket Options for IP and TCP Communication

socket options n.w
1 / 7
Embed
Share

Discover a comprehensive guide on socket options for IP and TCP, including how to examine and customize settings, manipulate options using various functions, and understand generic socket options and IP behaviors. Dive into a wealth of information to enhance your network communication capabilities.

  • Socket Options
  • TCP
  • IP Communication
  • Networking
  • Protocol

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Socket Options General socket options IP and TCP socket options Readings UNP Ch7

  2. A Summary Generic, TCP, and IP socket options can be examined and some modified getsockopt, setsockopt routines fcntl and ioctl functions Some examples: Socket (TCP/UDP) send/receive buffer size Socket (TCP/UDP) send/receive low watermark UDP broadcasting TCP keep alive timer IP options: e.g. source routing IP Time to live (TTL) IP quality of service (TOS) IP multicast options

  3. Functions to Manipulate Options #include <sys/socket.h> int getsockopt (int sockfd, int level, int optname, void *optval, socklen_t *optlen); Int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen); Level includes generic socket option and protocol- specific option SOL_SOCKET, IPPROTO_IP, IPPROTO_TCP, Option value can be of different types int, in_addr, timeval, that is why we use the void pointer

  4. Generic Socket Options Level = SOL_SOCKET Optnames SO_BROADCAST: permit sending broadcast datagram SO_DEBUG: enable debug tracing SO_DONTROUTE: used by routing daemon to make sure a packet goes through a certain interface. SO_ERROR: can only be obtained (not set), calling getsockopt reset error SO_KEEPALIVE: for TCP only, automatic send keepalive message when inactive for 2 hours (can be modified). SO_LINGER: for TCP only, determines the behavior when a close is called. SO_OOBINLINE: put out of band data in the normal input queue. SO_RCVBUF, SO_SNDBUF: send and receive buffer size.

  5. Generic Socket Options (Contd) Level = SOL_SOCKET Optnames: SO_RCVLOWAT, SO_SENDLOWAT: low watermark affect the select system call SO_RCVTIMEO, SO_SNDTIMEO: inherent timeout time (disabled by default) SO_REUSEADDR: Allows the port to be reused all server should do this to restart immediately SO_TYPE: socket type? SOCK_STREAM and SOCK_DGRAM. SO_USELOOPBACK: sending socket gets a copy? (only for routing domain AF_ROUTE))

  6. IP Options Allows packets sent through a socket to have certain behavior, e.g source routing Level = IPPROTO_IP Example optnames: (manipulating IP header fields) IP_OPTIONS: IP optional header fields IP_TOS, IP_TTL Example optnames (IP MULTICAST related) IP_MULTICAST_IF, IP_MULTICAST_TTL IP_MULTICAST_LOOP IP_ADD_MEMBERSHIP IP_DROP_MEMBERSHIP

  7. TCP Options Level = IPPROTO_TCP Optnames: TCP_KEEPALIVE: set the time TCP_MAXRT: maximum retransmission time TCP_MAXSEG: maximum segment size TCP_NODELAY: wait to ack or not (enable) TCP_STDURG: where is the urgent pointer. See example1.c

Related


More Related Content