Ioctl Operations. ioctl Function Interface Configuration  Netstat, ifconfig command 에서 사용.

Slides:



Advertisements
Similar presentations
Introduction to Sockets Jan Why do we need sockets? Provides an abstraction for interprocess communication.
Advertisements

Nonblocking I/O Blocking vs. non-blocking I/O
Socket Programming. Basics Socket is an interface between application and network – Application creates a socket – Socket type dictates the style of communication.
Socket Options. abstraction Introduction getsockopt and setsockopt function socket state Generic socket option IPv4 socket option ICMPv6 socket option.
CCNA – Network Fundamentals
I/O Multiplexing Road Map: 1. Motivation 2. Description of I/O multiplexing 3. Scenarios to use I/O multiplexing 4. I/O Models  Blocking I/O  Non-blocking.
TCP Lightweight Agent Project Goal : Implementation of a generic agent that will be able to measure connection parameters between a client and a server.
Today’s topic Issues about sending structures with TCP. Server design alternatives: concurrent server and multiplexed server. I/O multiplexing.
Computer Networks Sockets. Sockets and the OS F An end-point for Internet connection –What the application “plugs into” –OS provides Application Programming.
Elementary TCP Sockets Chapter 4 UNIX Network Programming Vol. 1, Second Ed. Stevens.
1 Java Networking – Part I CS , Spring 2008/9.
I/O Multiplexing© Dr. Ayman Abdel-Hamid, CS4254 Spring CS4254 Computer Network Architecture and Programming Dr. Ayman A. Abdel-Hamid Computer Science.
1 Nonblocking I/O Nonblocking reads and writes Buffers enabling overlapped nonblocking I/O Nonblocking connect.
Introduction to Project 1 Web Client and Server Jan 2006.
An Introduction to Internetworking. Algorithm for client-server communication with UDP (connectionless) A SERVER A CLIENT Create a server-socket (listener)and.
IP Multiplexing Ying Zhang EECS 489 W07.
Process-to-Process Delivery:
Server Design Discuss Design issues for Servers Review Server Creation in Linux.
The Transport Layer.
Elementary UDP Sockets© Dr. Ayman Abdel-Hamid, CS4254 Spring CS4254 Computer Network Architecture and Programming Dr. Ayman A. Abdel-Hamid Computer.
Hands On Networking Socket Programming Ram P Rustagi, ISE Dept Abhishek Gupta, ISE Dept Laxmi Kuber, MCA Dept June 28-30, 2012.
Elementary TCP Sockets
IP and Errors IP Best Effort Datagrams can be: –Lost –Delayed –Duplicated –Delivered out of order –Corrupted.
Signal-Driven I/O Concepts and steps for using signal-driven I/O
1 7-Oct-15 OSI transport layer CCNA Exploration Semester 1 Chapter 4.
Operating Systems Recitation 9, May 19-20, Iterative server Handle one connection request at a time. Connection requests stored in queue associated.
Transport Layer: TCP and UDP. Overview of TCP/IP protocols Comparing TCP and UDP TCP connection: establishment, data transfer, and termination Allocation.
More on Socket API. How to Place Timeouts on Sockets (1)  Using SIGALRM signal Connection timeout 기간의 축소 Response timeout advio/dgclitimeo3.clib/connect_timeo.c.
Socket programming. Sockets are a protocol independent method of creating a connection between processes. Sockets can be either: connection based or connectionless:
Nonblocking I/O Blocking vs. non-blocking I/O Nonblocking input, output, accept, and connect Readings –UNP Ch16 1.
Chapter 2 Applications and Layered Architectures Sockets.
Network Programming Eddie Aronovich mail:
7.9 TCP Socket Options 7.10 SCTP Socket Options 7.11 fcntl Function 7.12 Summary 報告者 : 梁凱鈞.
Application Block Diagram III. SOFTWARE PLATFORM Figure above shows a network protocol stack for a computer that connects to an Ethernet network and.
TELE 402 Lecture 4: I/O multi … 1 Overview Last Lecture –TCP socket and Client-Server example –Source: Chapters 4&5 of Stevens’ book This Lecture –I/O.
TELE 402 Lecture 10: Unix domain … 1 Overview Last Lecture –Daemon processes and advanced I/O functions This Lecture –Unix domain protocols and non-blocking.
1 I/O Multiplexing We often need to be able to monitor multiple descriptors:We often need to be able to monitor multiple descriptors: –a generic TCP client.
CSCE 515: Computer Network Programming Select Wenyuan Xu Department of Computer Science and Engineering.
I/O Multiplexing. TCP Echo Client: I/O operation is sequential !! tcpcliserv/tcpcli01.c: lib/str_cli.c: TCP Client TCP Server stdin stdout fgets fputs.
TCP/IP (Transmission Control Protocol / Internet Protocol)
CSE/EE 461 Getting Started with Networking. 2 Basic Concepts A PROCESS is an executing program somewhere. –Eg, “./a.out” A MESSAGE contains information.
Consider Letting inetd Launch Your Application. inetd daemon  Problems starting with /etc/rc(without inet daemon)  All the servers contains nearly identical.
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.
1 Socket Options getsockopt and setsockopt functions Check options and obtain default values Generic socket options IPv4 socket options IPv6 socket options.
UNIT-6. Basics of Networking TCP/IP Sockets Simple Client Server program Multiple clients Sending file from Server to Client Parallel search server.
Fall 2000M.B. Ibáñez Lecture 26 I/O Systems II. Fall 2000M.B. Ibáñez Application I/O Interface I/O system calls encapsulate device behaviors in generic.
CSCI 330 UNIX and Network Programming Unit XVII: Socket Programming Detail.
I/O Multiplexing Chap 6. I/O Models  Blocking I/O Model  Nonblocking I/O Model  I/O Multiplexing Model  Signal Driven I/O Model  Asynchronous I/O.
1 ioctl Function ioctl function get_ifi_info function ARP cache operations: eg. Print H/W addresses.
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
@Yuan Xue CS 283Computer Networks Spring 2013 Instructor: Yuan Xue.
1 K. Salah Application Layer Module K. Salah Network layer duties.
1 14-Jun-16 S Ward Abingdon and Witney College CCNA Exploration Semester 1 OSI transport layer CCNA Exploration Semester 1 Chapter 4.
SOCKET PROGRAMMING Presented By : Divya Sharma.
Introduction To Application Layer
IPv4 socket option Level => IPPROTO_IP
I/O Multiplexing.
Socket Option.
Elementary UDP Sockets
CHAPTER 8 ELEMENTARY UDP SOCKETS
Lecture 4 Socket Programming Issues
IS 4506 Server Configuration (HTTP Server)
Chapter 16 Socket Interface.
Advanced Network Programming spring 2007
Advanced UNIX programming
Starting TCP Connection – A High Level View
Server-side Programming CSE 333 Summer 2018
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
I/O Multiplexing We often need to be able to monitor multiple descriptors: a generic TCP client (like telnet) need to be able to handle unexpected situations,
Presentation transcript:

ioctl Operations

ioctl Function

Interface Configuration  Netstat, ifconfig command 에서 사용

ARP Caching and Routing Table Operations  ARP(Address Resolution Protocol) cache operations  ARP: protocol(IP) address  hardware address  Routing table operations

fcntl Function  Set socket for nonblocking I/O: F_SETFL, O_NONBLOCK  Set socket for signal-driven I/O: F_SETFL, O_ASYNC  Set socket owner: F_SETOWN  Get socket owner: F_GETOWN

Fcntl, ioctl, and routing socket

Nonblocking I/O

Blocking and Nonblocking Sockets OperationBlockingNonblocking Input TCP no data available in socket receive buffer Returns immediately with error of EWOULDBLOCK UDP socket receive buffer is empty Output TCP no room in socket send buffer immediate error return if no room in socket send buffer, or returns # of bytes written if some room in socket send buffer UDP never blocks (no actual UDP socket send buffer) never blocks (Returns # of bytes written) accept() new connection is not available Returns immediately with error of EWOULDBLOCK connec t() TCP blocks for at least RTT Returns immediately with error of EINPROGRESS if connection not established, or returns OK(==0) if connection established immediately UDP never blocks (just store peer’s IP addr/port #)

Buffering for Nonblocking Read/Write Send buffer Receive buffer

Nonblocking str_cli nonblock/strclinonb.c:

Time Line of Nonblocking Example

A Simpler Version of str_cli using concurrent processes

A Simpler Version of str_cli using Threads

Clock Time Comparison of str_cli  Sample case  input file of 2000 lines  175msec RTT  Stop-and wait:354.0 sec  select and blocking I/O: 12.3 sec  Nonblocking I/O: 6.9 sec  Two processes with fork: 8.7 sec  Threaded version: 8.5 sec 1 Simpler is better

Nonblocking connect  Usage  overlap other processing with three-way handshake(for RTT)  establish multiple connections: popular with Web browsers  shorten timeout for connection establishment(typically 75 sec)  by using select with time limit specification  Non blocking connect  Returns immediately with an error of EINPROGRESS, but TCP three-way handshake continues  check for either successful or unsuccessful completion of connection establishment using select  If server is on the same host, connection establishment normally takes place immediately(returns 0)  Many portability problems

Nonblocking Connect: Daytime Client lib/connect_nonb.c Shorten timeout

Nonblocking Multiple Connections: Web Client  Establish a connection for reading a page  Then, establish multiple connections for reading references in the page  Using nonblocking connections  Or using thread per connection

Nonblocking accept  Use nonblocking accept  Or, select for listening socket(may blocked) then, accept when listening socket is ready

Signal-Driven I/O

2 different ways to build a UDP server

Signal-Driven I/O for Sockets  Steps for Signal-driven I/O  establish SIGIO signal handler  set socket owner for receiving signals  fcntl(sockfd, F_SETOWN, getpid());  enable socket to signal-driven I/O  ioctl(sockfd, FIOASYNC, &on); /* signal-driven I/O */  ioctl(sockfd, FIONBIO, &on); /* non-blocking I/O */  SIGIO signal is generated whenever  for UDP socket  a datagram arrives  an asynchronous error occurs  for TCP sockets  Signal is generated too often  not useful  too many cases

UDP Echo Server using SIGIO (I) sigio/dgecho01.c

UDP Echo Server using SIGIO (II)