Advanced UNIX programming

Slides:



Advertisements
Similar presentations
Florida State UniversityCOP Advanced Unix Programming Raw Sockets Datalink Access Chapters 25, 26.
Advertisements

Nonblocking I/O Blocking vs. non-blocking I/O
Multicasting© Dr. Ayman Abdel-Hamid, CS4254 Spring CS4254 Computer Network Architecture and Programming Dr. Ayman A. Abdel-Hamid Computer Science.
Socket Options. abstraction Introduction getsockopt and setsockopt function socket state Generic socket option IPv4 socket option ICMPv6 socket option.
Netprog Advanced Sockets Programming1 Advanced Sockets Programming Ref: Chapter 7,11,21,22.
I/O Models Satish Krishnan. I/O Models Blocking I/O Non-blocking I/O I/O Multiplexing Signal driven I/O Asynchronous I/O.
Multicasting - Part II© Dr. Ayman Abdel-Hamid, CS4254 Spring CS4254 Computer Network Architecture and Programming Dr. Ayman A. Abdel-Hamid Computer.
Sockets CS 3516 – Computer Networks. Outline Socket basics Socket details (TCP and UDP) Socket options Final notes.
Distributed Computing Systems Sockets. Outline Socket basics Socket details (TCP and UDP) Socket options Final notes.
Lecture 19 Advanced Sockets Programming CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
MULTICAST USING UDP SOCKETS. PRELIMINARIES *CAST Unicast Communication is strictly from one sender to another specified receiver eg: TCP on LAN Broadcast.
Networks: TCP/IP Socket Calls1 Elementary TCP Sockets Chapter 4 UNIX Network Programming Vol. 1, Second Ed. Stevens.
Computer Networks Sockets.
Elementary TCP Sockets Chapter 4 UNIX Network Programming Vol. 1, Second Ed. Stevens.
Multimedia Networking Sockets. Outline Socket basics Socket details (TCP and UDP) Socket options Final notes.
Sockets IMGD Outline Socket basics Socket details (TCP and UDP) Socket options Final notes.
Socket Options Jari Kellokoski. Introduction So far we have discovered some basic usage of socket With socket options we control sockets more suitable.
1 I/O Multiplexing Computer Network Programming. 2 Input from multiple sources Process keyboard sockets file A process may have multiple sources of input.
Computer Networks Sockets. Outline F Socket basics F Socket details.
Computer Network Architecture and Programming
Operating Systems Sockets. Outline F Socket basics F TCP sockets F Socket details F Socket options F Final notes F Project 3.
Socket options A way for network applications to ‘tweak’ the processing done at lower-levels of the TCP/IP stack.
Socket option Getsockopt ou setsockopt fcntl ioctl.
1 Introduction to Raw Sockets 2 IP address Port address MAC address TCP/IP Stack 67 Bootp DHCP OSPF protocol frame type UDP Port # TCP Port.
ECE 4110 – Internetwork Programming Client-Server Model.
IT1352-NETWORK PROGRAMMING AND MANAGEMENT
More on Socket API. How to Place Timeouts on Sockets (1)  Using SIGALRM signal Connection timeout 기간의 축소 Response timeout advio/dgclitimeo3.clib/connect_timeo.c.
Review: How to create a TCP end point? What is the right format for sin_port and sin_addr in the sockaddr_in data structure? How many different ways we.
More on Socket API. More on Socket I/O Functions  Scatter read and gather write.
Netprog: Advanced Sockets Programming1 Advanced Sockets Programming Ref: Chapter 7,11,21,22.
Networking Tutorial Special Interest Group for Software Engineering Luke Rajlich.
1 Socket Options Ref: Chapter 7. 2 Socket Options Various attributes that are used to determine the behavior of sockets.Various attributes that are used.
Project Goal Convert existing (real) TCP/IP applications to native API This should be done with minimum modifications of the applications’ source code.
Socket options: a summary –Tcp options, ip options and general socket options can be examined and sometimes modified. getsockopt, setsockopt routines Some.
I/O Multiplexing. What is I/O multiplexing? When an application needs to handle multiple I/O descriptors at the same time –E.g. file and socket descriptors,
TELE 402 Lecture 12: Signal-Driven I/O & Raw Socket 1 Overview Last Lecture –Advanced UDP sockets and threads –Source: Chapters 22&26 of Stevens’ book.
Advanced UNIX programming Fall 2002 Instructor: Ashok Srinivasan Lecture 25 Acknowledgements: The syllabus and power point presentations are modified versions.
Advanced UNIX programming Fall 2002, lecture 16 Instructor: Ashok Srinivasan Acknowledgements: The syllabus and power point presentations are modified.
Today’s topic: UDP Reliable communication over UDP.
Advanced UNIX progamming Fall 2002 Instructor: Ashok Srinivasan Lecture 9 Acknowledgements: The syllabus and power point presentations are modified versions.
Review: –Concurrent server and multiplexed server How they work? Which one is better?
1 Socket Options getsockopt and setsockopt functions Check options and obtain default values Generic socket options IPv4 socket options IPv6 socket options.
S OCKET P ROGRAMMING IN C Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.
CMPT 471 Networking II Network Programming © Janice Regan,
CSCI 330 UNIX and Network Programming Unit XIV: User Datagram Protocol.
IP Configuration API. Network Interface Configuration NAIfconfigIsDeviceUp() NAIfconfigDeviceFromInterface() NAIfconfigBringDeviceUp() NAIfconfigSetIpAddress()
Advanced UNIX programming Fall 2002 Instructor: Ashok Srinivasan Lecture 28 Acknowledgements: The syllabus and power point presentations are modified versions.
Advanced UNIX programming Fall 2002 Instructor: Ashok Srinivasan Lecture 17 Acknowledgements: The syllabus and power point presentations are modified versions.
Computer Networking Project II question/answer session October 18, 2001.
Lecture 3 TCP and UDP Sockets CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
Sockets API Developing Applications using the Sockets API.
IPv4 socket option Level => IPPROTO_IP
Socket Option.
Operating Systems Sockets ENCE 360.
Sockets and Beginning Network Programming
Transport Layer.
Advanced UNIX progamming
CHAPTER 8 ELEMENTARY UDP SOCKETS
Network Programming CSC- 341
Chapter 07. Socket Options.
Advanced Network Programming spring 2007
Advanced UNIX programming
Advanced Sockets Programming
Advanced UNIX progamming
Advanced UNIX programming
Advanced I/O Functions
Outline Communications in Distributed Systems Socket Programming
Today’s topic: Basic TCP API
Socket options: a summary
Advanced UNIX programming
Presentation transcript:

Advanced UNIX programming Fall 2002 Instructor: Ashok Srinivasan Lecture 23 Acknowledgements: The syllabus and power point presentations are modified versions of those by T. Baker and X. Yuan

Announcements Reading assignment Chapter 7 Chapter 8 Sections 7.1 – 7.6 and 7.9 – 7.11 Chapter 8 Midterm next Monday

Week 9 Topics Socket options Introduction to UDP getsockopt, setsockopt fcntl ioctl Introduction to UDP TCP vs UDP UDP interface

Socket options getsockopt, setsockopt fcntl ioctl General socket options IP options TCP options fcntl ioctl

getsockopt, setsockopt #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); The level includes general socket options (SOL_SOCKET) and protocol-specific options (for IP, TCP, etc). Option value can be of different types: pointers to int, in_addr, timeval, etc

General socket options level = SOL_SOCKET, optnames = SO_BROADCAST Permit sending broadcast datagram SO_KEEPALIVE For TCP only, automatically send a keepalive message when inactive for 2 hours (can be modified) SO_LINGER for TCP only, determines behavior on close SO_RCVBUF, SO_SNDBUF Send and receive buffer size

General socket options (continued) level = SOL_SOCKET, optnames = SO_RCVLOWAT, SO_SENDLOWAT low watermark – affects the select system call SO_RCVTIMEO, SO_SNDTIMEO Inherent timeout time (disabled by default) SO_TYPE Socket type: SOCK_STREAM and SOCK_DGRAM Etc.

IP options Allows packets sent through a socket to have certain behavior For example, source routing level = IPPROTO_IP optname (manipulating IP header fields) IP_OPTIONS IP_RECVDSTADDR IP_RECVIF IP_TOS IP_TTL Etc.

level = IPPROTO_TCP, optname = TCP options level = IPPROTO_TCP, optname = TCP_KEEPALIVE Set the time TCP_MAXRT Maximum retransmission time TCP_MAXSEG Maximum segment size See example1.c

fcntl and ioctl fcntl ioctl File control on open files Set file descriptor flags (FD_CLOEXEC) Non-blocking mode, etc. ioctl Some I/O control operations