SlideShare a Scribd company logo
Advanced Sockets Programming

      Ref: Chapter 7,11,21,22




                                1
• Socket Options • Posix name/address conversion

• Out-of-Band Data     • Signal Driven I/O

• It's important to know about some of these
  topics, although it might not be apparent
  how and when to use them.

• Details are in the book - we are just trying
  to get some idea of what can be done.


                                                   2
Socket Options
• Various attributes that are used to determine
  the behavior of sockets.
• Setting options tells the OS/Protocol Stack
  the behavior we want.
• Support for generic options (apply to all
  sockets) and protocol specific options.



                                                  3
Option types
• Many socket options are boolean flags
  indicating whether some feature is enabled
  (1) or disabled (0).
• Other options are associated with more
  complex types including int,
  timeval, in_addr, sockaddr, etc.
• Some options are readable only (we can’t
  set the value).
                                               4
Setting and Getting option values
getsockopt() gets the current value of a
 socket option.

setsockopt() is used to set the value of a
 socket option.




                                             5
int getsockopt( int sockfd,
                int level,
                int optname,
                void *opval,
                socklen_t *optlen);


level specifies whether the option is a
 general option or a protocol specific option
 (what level of code should interpret the
 option).


                                                6
int setsockopt( int sockfd,
                int level,
                int optname,
                const void *opval,
                socklen_t optlen);


level specifies whether the option is a
 general option or a protocol specific option
 (what level of code should interpret the
 option).

                                                7
General Options
• Protocol independent options.
• Handled by the generic socket system code.
• Some options are supported only by specific
  types of sockets (SOCK_DGRAM,
  SOCK_STREAM).




                                                8
Some Generic Options
SO_BROADCAST
SO_DONTROUTE
SO_ERROR
SO_KEEPALIVE
SO_LINGER
SO_RCVBUF,SO_SNDBUF
SO_REUSEADDR
                          9
SO_BROADCAST
• Boolean option: enables/disables sending of
  broadcast messages.
• Underlying DL layer must support
  broadcasting!
• Applies only to SOCK_DGRAM sockets.
• Prevents applications from inadvertently
  sending broadcasts (OS looks for this flag
  when broadcast address is specified).
                                                10
SO_DONTROUTE
• Boolean option: enables bypassing of
  normal routing.
• Used by routing daemons.




                                         11
SO_ERROR
• Integer value option.
• Value is an error indicator value as used by
  errno.
• Readable (get’able) only!
• Reading (by calling getsockopt())
  clears any pending error.


                                                 12
SO_KEEPALIVE
• Boolen option: enabled means that
  STREAM sockets should send a probe to
  peer if no data flow for a “long time”.
• Used by TCP - allows a process to
  determine whether peer process/host has
  crashed.
• Consider what would happen to an open
  telnet connection without keepalive.
                                            13
SO_LINGER
• Value is:
struct linger {
     int l_onoff;  /* 0 = off */
     int l_linger; /* time in seconds */
};
• Used to control whether and how long a call
  to close will wait for pending ACKS.
• connection-oriented sockets only.
                                                14
SO_LINGER
• By default, calling close() on a TCP
  socket will return immediately.
• The closing process has no way of knowing
  whether or not the peer received all data.
• Setting SO_LINGER means the closing
  process can determine that the peer machine
  has received the data (but not that the data
  has been read() !).
                                                 15
SO_RCVBUF
              SO_SNDBUF
• Integer values options - change the receive
  and send buffer sizes.
• Can be used with STREAM and DGRAM
  sockets.
• With TCP, this option effects the window
  size used for flow control - must be
  established before connection is made.

                                                16
SO_REUSEADDR
• Boolean option: enables binding to an
  address (port) that is already in use.
• Used by servers that are transient - allows
  binding a passive socket to a port currently
  in use (with active sockets) by other
  processes.
• Can be used to establish separate servers for
  the same service on different interfaces (or
  different IP addresses on the same interface)   17
IP Options (IPv4)
• IP_HDRINCL: used on raw IP sockets
  when we want to build the IP header
  ourselves.
• IP_TOS: allows us to set the “Type-of-
  service” field in an IP header.
• IP_TTL: allows us to set the “Time-to-live”
  field in an IP header.

                                                18
TCP socket options
• TCP_KEEPALIVE: set the idle time used
  when SO_KEEPALIVE is enabled.
• TCP_MAXSEG: set the maximum segment
  size sent by a TCP socket.
• TCP_NODELAY: can disable TCP’s Nagle
  algorithm that delays sending small packets
  if there is unACK’d data pending.

                                                19
• This was just an overview
  – there are many details associated with the
    options described.
  – There are many options that haven’t been
    described.




                                                 20
Posix Name/Adress Conversion
• We've seen gethostbyname and
  gethostbyaddr - these are protocol
  dependent.
  – Not part of sockets library.
• Posix includes protocol independent
  functions:
      getaddrinfo()          getnameinfo()


                                             21
getaddrinfo, getnameinfo
• These functions provide name/address
  conversions as part of the sockets library.
• In the future it will be important to write
  code that can run on many protocols (IPV4,
  IPV6), but for now these functions are not
  widely available.
  – It's worth seeing how they work even though
    we probably can't use them yet!

                                                  22
getaddrinfo()
• Puts protocol dependence in library (where
  it belongs).
  – Same code can be used for many protocols, we
    will see examples when we talk about IPV6
  – re-entrant function - gethostbyname is not!
     • Important to threaded applications.




                                                   23
getaddrinfo()
int getaddrinfo(
     const char *hostname,
     const char *service,
     const struct addrinfo* hints,
     struct addrinfo **result);


getaddrinfo() replaces both gethostbyname()
  and getservbyname()


                                              24
getaddrinfo()
Hostname is a hostname or an address string (dotted
  decimal string for IP).

Service is a service name or a decimal port number
  string.




                                                      25
struct addrinfo

struct addrinfo {
  int     ai_flags;
  int     ai_family;
  int     ai_socktype;
  int     ai_protocol;
  size_t ai_addrlen;
                                         li st!
  char    *canonname;               ed
  struct sockaddr *ai_addr;   L ink
  struct addrinfo *ai_next;
};
                                              26
getaddrinfo()
hints is an addrinfo * (can be NULL) that can
  contain:
  – ai_flags     (AI_PASSIVE , AI_CANONNAME )
  – ai_family    (AF_XXX )
  – ai_socktype        (SOCK_XXX )
  – ai_protocol        (IPPROTO_TCP, etc.)




                                                27
getaddrinfo
result is returned with the address of a pointer to
  an addrinfo structure that is the head of a
  linked list.

It is possible to get multiple structures:
   – multiple addresses associated with the hostname.
   – The service is provided for multiple socket types.




                                                          28
addrinfo usage

ai_flags             Used in call to socket()
ai_family
ai_socktype
ai_protocol        Used in call to bind(), connect()
ai_addrlen               or sendto()
ai_canonname
ai_addr
ai_next
                     ai_flags
                     ai_family
                     ai_socktype
                     ai_protocol
                     ai_addrlen
                     ai_canonname
                     ai_addr
                     ai_next
                                                  29
getnameinfo()
int getnameinfo(
     const struct sockaddr *sockaddr,
     socklen_t addrlen
     char *host,
     size_t hostlen,
     char *serv,
     size_t servlen,
     int flags);


getnameinfo() looks up a hostname and a service
  name given a sockaddr
                                                  30
Out-of-Band Date
• Ever been on a date, gone to a dance club
  and the band doesn't show up?
  – This is becoming a serious problem:
     • The number of Internet dating services is growing
       exponentially.
     • The number of bands is not growing.
  – RFC 90210 proposes some short term solutions
    (until the number of bands can be increased).


                                                           31
Out-of-Band Data
• TCP (and other transport layers) provide a
  mechanism for delivery of quot;high priorityquot;
  data ahead of quot;normal dataquot;.
• We can almost think of this as 2 streams:
                   normal data

  TCP PORT                          TCP PORT
      A                                 B

                  special data

                                               32
TCP OOB Data
• TCP supports something like OOB data
  using URGENT MODE (a bit is send in a
  TCP segment header).
• A TCP segment header field contains an
  indication of the location of the urgent data
  in the stream (the byte number).
• The details are not important to us (we just
  want to see how to use this in our program).
                                                  33
Sending OOB Data
           send(sd,buff,1,MSG_OOB);


Can use send() to put a single byte of urgent data in a
  TCP stream.

The TCP layer adds some segment header info to let
  the other end know there is some OOB data.
The TCP layer on the receiving end treats the data
  marked as urgent in a special way.
                                                          34
Receiving OOB Data
• The TCP layer generates a SIGURG signal
  in the receiving process.
• Select() will tell you an exception
  condition is present.
• Depending on how things are set up:
  – the data can be read using recv() with a
    MSG_OOB flag set.
  – The data can be read inline and the receiving
    process can moniter the out-of-band-mark for
    the connection (using sockatmark())

                                                    35
So what?
• OOB Data might be used:
  – a heartbeat between the client and server to
    detect early failure (example in the book).
  – A way to communicate an exceptional
    condition to a peer even when flow control has
    stopped the sender.




                                                     36
Singles Driven IOU
• Another problem with Internet Dating
  services is the lack of single drivers in many
  metropolitan areas.
  – Neither participant can pick up the other.
  – Dating protocols degrade to involve online
    communication only.
  – Proxy drivers (running TAXI protocol) get
    overloaded and refuse IOU packets.

                                                   37
Signal Driven I/O
• We can tell the kernel to send a SIGIO
  signal whenever something happens to a
  socket descriptor.
• The signal handler must determine what
  conditions caused the signal and take
  appropriate action.



                                           38
Signal Driven UDP
• SIGIO occurs whenever:
  – an incoming datagram arrives.
  – An asynchronous error occurs.
     • Could be ICMP error (unreachable, invalid address,
       etc).
• Could allow process to handle other tasks
  and still watch for incoming UDP messages.


                                                            39
Signal Driven TCP
• SIGIO occurs whenever:
  – an incoming connection has completed.
  – Disconnect request initiated.
  – Disconnect request completed.
  – Half a connection shutdown.
  – Data has arrived.
  – Data has been sent (indicating there is buffer space)
  – asynchronous error
                                                            40

More Related Content

What's hot

MSTP High Level Overview
MSTP High Level OverviewMSTP High Level Overview
MSTP High Level Overview
Gary Jan
 
MPLS WC 2014 Segment Routing TI-LFA Fast ReRoute
MPLS WC 2014  Segment Routing TI-LFA Fast ReRouteMPLS WC 2014  Segment Routing TI-LFA Fast ReRoute
MPLS WC 2014 Segment Routing TI-LFA Fast ReRoute
Bruno Decraene
 
OSPF Basics
OSPF BasicsOSPF Basics
OSPF Basics
Martin Bratina
 
Access control list 2
Access control list 2Access control list 2
Access control list 2
Kishore Kumar
 
MENOG-Segment Routing Introduction
MENOG-Segment Routing IntroductionMENOG-Segment Routing Introduction
MENOG-Segment Routing Introduction
Rasoul Mesghali, CCIE RS
 
Iperf Tutorial
Iperf Tutorial Iperf Tutorial
Iperf Tutorial
Febrian ‎
 
Omega example
Omega exampleOmega example
Omega example
Teja Teju
 
JUNOS EX-Switching
JUNOS EX-SwitchingJUNOS EX-Switching
JUNOS EX-Switching
Zenith Networks
 
ipv6 ppt
ipv6 pptipv6 ppt
ipv6 ppt
Shiva Kumar
 
Segment Routing Advanced Use Cases - Cisco Live 2016 USA
Segment Routing Advanced Use Cases - Cisco Live 2016 USASegment Routing Advanced Use Cases - Cisco Live 2016 USA
Segment Routing Advanced Use Cases - Cisco Live 2016 USA
Jose Liste
 
Axi protocol
Axi protocolAxi protocol
Axi protocol
Azad Mishra
 
IPv6 Overview
IPv6 OverviewIPv6 Overview
IPv6 Overview
William Lee
 
TCP/IP FRAME FORMAT
TCP/IP FRAME FORMATTCP/IP FRAME FORMAT
TCP/IP FRAME FORMAT
Manjushree Mashal
 
Cisco CCNA- DHCP Server
Cisco CCNA-  DHCP ServerCisco CCNA-  DHCP Server
Cisco CCNA- DHCP Server
Hamed Moghaddam
 
OSI Layers
OSI LayersOSI Layers
OSI Layers
Kishore Kumar
 
SIP (Session Initiation Protocol)
SIP (Session Initiation Protocol)SIP (Session Initiation Protocol)
SIP (Session Initiation Protocol)
KHNOG
 
Uvm dcon2013
Uvm dcon2013Uvm dcon2013
Uvm dcon2013
sean chen
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux Kernel
Divye Kapoor
 
Access Control List 1
Access Control List 1Access Control List 1
Access Control List 1
Kishore Kumar
 
SDN Architecture & Ecosystem
SDN Architecture & EcosystemSDN Architecture & Ecosystem
SDN Architecture & Ecosystem
Kingston Smiler
 

What's hot (20)

MSTP High Level Overview
MSTP High Level OverviewMSTP High Level Overview
MSTP High Level Overview
 
MPLS WC 2014 Segment Routing TI-LFA Fast ReRoute
MPLS WC 2014  Segment Routing TI-LFA Fast ReRouteMPLS WC 2014  Segment Routing TI-LFA Fast ReRoute
MPLS WC 2014 Segment Routing TI-LFA Fast ReRoute
 
OSPF Basics
OSPF BasicsOSPF Basics
OSPF Basics
 
Access control list 2
Access control list 2Access control list 2
Access control list 2
 
MENOG-Segment Routing Introduction
MENOG-Segment Routing IntroductionMENOG-Segment Routing Introduction
MENOG-Segment Routing Introduction
 
Iperf Tutorial
Iperf Tutorial Iperf Tutorial
Iperf Tutorial
 
Omega example
Omega exampleOmega example
Omega example
 
JUNOS EX-Switching
JUNOS EX-SwitchingJUNOS EX-Switching
JUNOS EX-Switching
 
ipv6 ppt
ipv6 pptipv6 ppt
ipv6 ppt
 
Segment Routing Advanced Use Cases - Cisco Live 2016 USA
Segment Routing Advanced Use Cases - Cisco Live 2016 USASegment Routing Advanced Use Cases - Cisco Live 2016 USA
Segment Routing Advanced Use Cases - Cisco Live 2016 USA
 
Axi protocol
Axi protocolAxi protocol
Axi protocol
 
IPv6 Overview
IPv6 OverviewIPv6 Overview
IPv6 Overview
 
TCP/IP FRAME FORMAT
TCP/IP FRAME FORMATTCP/IP FRAME FORMAT
TCP/IP FRAME FORMAT
 
Cisco CCNA- DHCP Server
Cisco CCNA-  DHCP ServerCisco CCNA-  DHCP Server
Cisco CCNA- DHCP Server
 
OSI Layers
OSI LayersOSI Layers
OSI Layers
 
SIP (Session Initiation Protocol)
SIP (Session Initiation Protocol)SIP (Session Initiation Protocol)
SIP (Session Initiation Protocol)
 
Uvm dcon2013
Uvm dcon2013Uvm dcon2013
Uvm dcon2013
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux Kernel
 
Access Control List 1
Access Control List 1Access Control List 1
Access Control List 1
 
SDN Architecture & Ecosystem
SDN Architecture & EcosystemSDN Architecture & Ecosystem
SDN Architecture & Ecosystem
 

Viewers also liked

Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScript
elliando dias
 
SharePoint Governance and Lifecycle Management with Project Server 2010
SharePoint Governance and Lifecycle Management with Project Server 2010SharePoint Governance and Lifecycle Management with Project Server 2010
SharePoint Governance and Lifecycle Management with Project Server 2010
Alexander Burton
 
Advanced java programming-contents
Advanced java programming-contentsAdvanced java programming-contents
Advanced java programming-contents
Self-Employed
 
Internet programming lecture 1
Internet programming lecture 1Internet programming lecture 1
Internet programming lecture 1
Mohammed Hussein
 
indrodução automação industrial
indrodução automação industrialindrodução automação industrial
indrodução automação industrial
elliando dias
 
Socket System Calls
Socket System CallsSocket System Calls
Socket System Calls
Avinash Varma Kalidindi
 
Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programming
Roger Argarin
 

Viewers also liked (7)

Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScript
 
SharePoint Governance and Lifecycle Management with Project Server 2010
SharePoint Governance and Lifecycle Management with Project Server 2010SharePoint Governance and Lifecycle Management with Project Server 2010
SharePoint Governance and Lifecycle Management with Project Server 2010
 
Advanced java programming-contents
Advanced java programming-contentsAdvanced java programming-contents
Advanced java programming-contents
 
Internet programming lecture 1
Internet programming lecture 1Internet programming lecture 1
Internet programming lecture 1
 
indrodução automação industrial
indrodução automação industrialindrodução automação industrial
indrodução automação industrial
 
Socket System Calls
Socket System CallsSocket System Calls
Socket System Calls
 
Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programming
 

Similar to Advanced Sockets Programming

Np unit2
Np unit2Np unit2
Np unit2
vamsitricks
 
Basic socket programming
Basic socket programmingBasic socket programming
Basic socket programming
Kristian Arjianto
 
TCP IP
TCP IPTCP IP
TCP IP
hivasu
 
Socket Programming
Socket ProgrammingSocket Programming
Socket Programming
CEC Landran
 
Sockets
SocketsSockets
Socket programming using C
Socket programming using CSocket programming using C
Socket programming using C
Ajit Nayak
 
L5-Sockets.pptx
L5-Sockets.pptxL5-Sockets.pptx
L5-Sockets.pptx
ycelgemici1
 
Socket programming
Socket programming Socket programming
Socket programming
Rajivarnan (Rajiv)
 
sockets
socketssockets
Introduction to sockets tcp ip protocol.ppt
Introduction to sockets tcp ip protocol.pptIntroduction to sockets tcp ip protocol.ppt
Introduction to sockets tcp ip protocol.ppt
MajedAboubennah
 
A.java
A.javaA.java
Surviving The Stump The Chump Interview Questions
Surviving The Stump The Chump Interview QuestionsSurviving The Stump The Chump Interview Questions
Surviving The Stump The Chump Interview Questions
Duane Bodle
 
acn-practical_manual-19-20-1 final.pdf
acn-practical_manual-19-20-1 final.pdfacn-practical_manual-19-20-1 final.pdf
acn-practical_manual-19-20-1 final.pdf
Qual4
 
Networking chapter VI
Networking chapter VINetworking chapter VI
Networking chapter VI
Jayakumar Balasubramanian
 
Linux Networking Commands
Linux Networking CommandsLinux Networking Commands
Linux Networking Commands
tmavroidis
 
Advanced RAC troubleshooting: Network
Advanced RAC troubleshooting: NetworkAdvanced RAC troubleshooting: Network
Advanced RAC troubleshooting: Network
Riyaj Shamsudeen
 
Network Programming: Data Plane Development Kit (DPDK)
Network Programming: Data Plane Development Kit (DPDK)Network Programming: Data Plane Development Kit (DPDK)
Network Programming: Data Plane Development Kit (DPDK)
Andriy Berestovskyy
 
Basics of sockets
Basics of socketsBasics of sockets
Basics of sockets
AviNash ChaVhan
 
File 10 - CSX 334 _VRA NBO.ppsx
File 10 - CSX 334 _VRA NBO.ppsxFile 10 - CSX 334 _VRA NBO.ppsx
File 10 - CSX 334 _VRA NBO.ppsx
gaurav201196
 
123
123123

Similar to Advanced Sockets Programming (20)

Np unit2
Np unit2Np unit2
Np unit2
 
Basic socket programming
Basic socket programmingBasic socket programming
Basic socket programming
 
TCP IP
TCP IPTCP IP
TCP IP
 
Socket Programming
Socket ProgrammingSocket Programming
Socket Programming
 
Sockets
SocketsSockets
Sockets
 
Socket programming using C
Socket programming using CSocket programming using C
Socket programming using C
 
L5-Sockets.pptx
L5-Sockets.pptxL5-Sockets.pptx
L5-Sockets.pptx
 
Socket programming
Socket programming Socket programming
Socket programming
 
sockets
socketssockets
sockets
 
Introduction to sockets tcp ip protocol.ppt
Introduction to sockets tcp ip protocol.pptIntroduction to sockets tcp ip protocol.ppt
Introduction to sockets tcp ip protocol.ppt
 
A.java
A.javaA.java
A.java
 
Surviving The Stump The Chump Interview Questions
Surviving The Stump The Chump Interview QuestionsSurviving The Stump The Chump Interview Questions
Surviving The Stump The Chump Interview Questions
 
acn-practical_manual-19-20-1 final.pdf
acn-practical_manual-19-20-1 final.pdfacn-practical_manual-19-20-1 final.pdf
acn-practical_manual-19-20-1 final.pdf
 
Networking chapter VI
Networking chapter VINetworking chapter VI
Networking chapter VI
 
Linux Networking Commands
Linux Networking CommandsLinux Networking Commands
Linux Networking Commands
 
Advanced RAC troubleshooting: Network
Advanced RAC troubleshooting: NetworkAdvanced RAC troubleshooting: Network
Advanced RAC troubleshooting: Network
 
Network Programming: Data Plane Development Kit (DPDK)
Network Programming: Data Plane Development Kit (DPDK)Network Programming: Data Plane Development Kit (DPDK)
Network Programming: Data Plane Development Kit (DPDK)
 
Basics of sockets
Basics of socketsBasics of sockets
Basics of sockets
 
File 10 - CSX 334 _VRA NBO.ppsx
File 10 - CSX 334 _VRA NBO.ppsxFile 10 - CSX 334 _VRA NBO.ppsx
File 10 - CSX 334 _VRA NBO.ppsx
 
123
123123
123
 

More from elliando dias

Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slides
elliando dias
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structures
elliando dias
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de container
elliando dias
 
Geometria Projetiva
Geometria ProjetivaGeometria Projetiva
Geometria Projetiva
elliando dias
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
elliando dias
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Libraries
elliando dias
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!
elliando dias
 
Ragel talk
Ragel talkRagel talk
Ragel talk
elliando dias
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Web
elliando dias
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduino
elliando dias
 
Minicurso arduino
Minicurso arduinoMinicurso arduino
Minicurso arduino
elliando dias
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorcery
elliando dias
 
Rango
RangoRango
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Design
elliando dias
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makes
elliando dias
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
elliando dias
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.
elliando dias
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebook
elliando dias
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Study
elliando dias
 
From Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn IntroductionFrom Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn Introduction
elliando dias
 

More from elliando dias (20)

Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slides
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structures
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de container
 
Geometria Projetiva
Geometria ProjetivaGeometria Projetiva
Geometria Projetiva
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Libraries
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!
 
Ragel talk
Ragel talkRagel talk
Ragel talk
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Web
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduino
 
Minicurso arduino
Minicurso arduinoMinicurso arduino
Minicurso arduino
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorcery
 
Rango
RangoRango
Rango
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Design
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makes
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebook
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Study
 
From Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn IntroductionFrom Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn Introduction
 

Recently uploaded

Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Zilliz
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 

Recently uploaded (20)

Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 

Advanced Sockets Programming

  • 1. Advanced Sockets Programming Ref: Chapter 7,11,21,22 1
  • 2. • Socket Options • Posix name/address conversion • Out-of-Band Data • Signal Driven I/O • It's important to know about some of these topics, although it might not be apparent how and when to use them. • Details are in the book - we are just trying to get some idea of what can be done. 2
  • 3. Socket Options • Various attributes that are used to determine the behavior of sockets. • Setting options tells the OS/Protocol Stack the behavior we want. • Support for generic options (apply to all sockets) and protocol specific options. 3
  • 4. Option types • Many socket options are boolean flags indicating whether some feature is enabled (1) or disabled (0). • Other options are associated with more complex types including int, timeval, in_addr, sockaddr, etc. • Some options are readable only (we can’t set the value). 4
  • 5. Setting and Getting option values getsockopt() gets the current value of a socket option. setsockopt() is used to set the value of a socket option. 5
  • 6. int getsockopt( int sockfd, int level, int optname, void *opval, socklen_t *optlen); level specifies whether the option is a general option or a protocol specific option (what level of code should interpret the option). 6
  • 7. int setsockopt( int sockfd, int level, int optname, const void *opval, socklen_t optlen); level specifies whether the option is a general option or a protocol specific option (what level of code should interpret the option). 7
  • 8. General Options • Protocol independent options. • Handled by the generic socket system code. • Some options are supported only by specific types of sockets (SOCK_DGRAM, SOCK_STREAM). 8
  • 10. SO_BROADCAST • Boolean option: enables/disables sending of broadcast messages. • Underlying DL layer must support broadcasting! • Applies only to SOCK_DGRAM sockets. • Prevents applications from inadvertently sending broadcasts (OS looks for this flag when broadcast address is specified). 10
  • 11. SO_DONTROUTE • Boolean option: enables bypassing of normal routing. • Used by routing daemons. 11
  • 12. SO_ERROR • Integer value option. • Value is an error indicator value as used by errno. • Readable (get’able) only! • Reading (by calling getsockopt()) clears any pending error. 12
  • 13. SO_KEEPALIVE • Boolen option: enabled means that STREAM sockets should send a probe to peer if no data flow for a “long time”. • Used by TCP - allows a process to determine whether peer process/host has crashed. • Consider what would happen to an open telnet connection without keepalive. 13
  • 14. SO_LINGER • Value is: struct linger { int l_onoff; /* 0 = off */ int l_linger; /* time in seconds */ }; • Used to control whether and how long a call to close will wait for pending ACKS. • connection-oriented sockets only. 14
  • 15. SO_LINGER • By default, calling close() on a TCP socket will return immediately. • The closing process has no way of knowing whether or not the peer received all data. • Setting SO_LINGER means the closing process can determine that the peer machine has received the data (but not that the data has been read() !). 15
  • 16. SO_RCVBUF SO_SNDBUF • Integer values options - change the receive and send buffer sizes. • Can be used with STREAM and DGRAM sockets. • With TCP, this option effects the window size used for flow control - must be established before connection is made. 16
  • 17. SO_REUSEADDR • Boolean option: enables binding to an address (port) that is already in use. • Used by servers that are transient - allows binding a passive socket to a port currently in use (with active sockets) by other processes. • Can be used to establish separate servers for the same service on different interfaces (or different IP addresses on the same interface) 17
  • 18. IP Options (IPv4) • IP_HDRINCL: used on raw IP sockets when we want to build the IP header ourselves. • IP_TOS: allows us to set the “Type-of- service” field in an IP header. • IP_TTL: allows us to set the “Time-to-live” field in an IP header. 18
  • 19. TCP socket options • TCP_KEEPALIVE: set the idle time used when SO_KEEPALIVE is enabled. • TCP_MAXSEG: set the maximum segment size sent by a TCP socket. • TCP_NODELAY: can disable TCP’s Nagle algorithm that delays sending small packets if there is unACK’d data pending. 19
  • 20. • This was just an overview – there are many details associated with the options described. – There are many options that haven’t been described. 20
  • 21. Posix Name/Adress Conversion • We've seen gethostbyname and gethostbyaddr - these are protocol dependent. – Not part of sockets library. • Posix includes protocol independent functions: getaddrinfo() getnameinfo() 21
  • 22. getaddrinfo, getnameinfo • These functions provide name/address conversions as part of the sockets library. • In the future it will be important to write code that can run on many protocols (IPV4, IPV6), but for now these functions are not widely available. – It's worth seeing how they work even though we probably can't use them yet! 22
  • 23. getaddrinfo() • Puts protocol dependence in library (where it belongs). – Same code can be used for many protocols, we will see examples when we talk about IPV6 – re-entrant function - gethostbyname is not! • Important to threaded applications. 23
  • 24. getaddrinfo() int getaddrinfo( const char *hostname, const char *service, const struct addrinfo* hints, struct addrinfo **result); getaddrinfo() replaces both gethostbyname() and getservbyname() 24
  • 25. getaddrinfo() Hostname is a hostname or an address string (dotted decimal string for IP). Service is a service name or a decimal port number string. 25
  • 26. struct addrinfo struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; size_t ai_addrlen; li st! char *canonname; ed struct sockaddr *ai_addr; L ink struct addrinfo *ai_next; }; 26
  • 27. getaddrinfo() hints is an addrinfo * (can be NULL) that can contain: – ai_flags (AI_PASSIVE , AI_CANONNAME ) – ai_family (AF_XXX ) – ai_socktype (SOCK_XXX ) – ai_protocol (IPPROTO_TCP, etc.) 27
  • 28. getaddrinfo result is returned with the address of a pointer to an addrinfo structure that is the head of a linked list. It is possible to get multiple structures: – multiple addresses associated with the hostname. – The service is provided for multiple socket types. 28
  • 29. addrinfo usage ai_flags Used in call to socket() ai_family ai_socktype ai_protocol Used in call to bind(), connect() ai_addrlen or sendto() ai_canonname ai_addr ai_next ai_flags ai_family ai_socktype ai_protocol ai_addrlen ai_canonname ai_addr ai_next 29
  • 30. getnameinfo() int getnameinfo( const struct sockaddr *sockaddr, socklen_t addrlen char *host, size_t hostlen, char *serv, size_t servlen, int flags); getnameinfo() looks up a hostname and a service name given a sockaddr 30
  • 31. Out-of-Band Date • Ever been on a date, gone to a dance club and the band doesn't show up? – This is becoming a serious problem: • The number of Internet dating services is growing exponentially. • The number of bands is not growing. – RFC 90210 proposes some short term solutions (until the number of bands can be increased). 31
  • 32. Out-of-Band Data • TCP (and other transport layers) provide a mechanism for delivery of quot;high priorityquot; data ahead of quot;normal dataquot;. • We can almost think of this as 2 streams: normal data TCP PORT TCP PORT A B special data 32
  • 33. TCP OOB Data • TCP supports something like OOB data using URGENT MODE (a bit is send in a TCP segment header). • A TCP segment header field contains an indication of the location of the urgent data in the stream (the byte number). • The details are not important to us (we just want to see how to use this in our program). 33
  • 34. Sending OOB Data send(sd,buff,1,MSG_OOB); Can use send() to put a single byte of urgent data in a TCP stream. The TCP layer adds some segment header info to let the other end know there is some OOB data. The TCP layer on the receiving end treats the data marked as urgent in a special way. 34
  • 35. Receiving OOB Data • The TCP layer generates a SIGURG signal in the receiving process. • Select() will tell you an exception condition is present. • Depending on how things are set up: – the data can be read using recv() with a MSG_OOB flag set. – The data can be read inline and the receiving process can moniter the out-of-band-mark for the connection (using sockatmark()) 35
  • 36. So what? • OOB Data might be used: – a heartbeat between the client and server to detect early failure (example in the book). – A way to communicate an exceptional condition to a peer even when flow control has stopped the sender. 36
  • 37. Singles Driven IOU • Another problem with Internet Dating services is the lack of single drivers in many metropolitan areas. – Neither participant can pick up the other. – Dating protocols degrade to involve online communication only. – Proxy drivers (running TAXI protocol) get overloaded and refuse IOU packets. 37
  • 38. Signal Driven I/O • We can tell the kernel to send a SIGIO signal whenever something happens to a socket descriptor. • The signal handler must determine what conditions caused the signal and take appropriate action. 38
  • 39. Signal Driven UDP • SIGIO occurs whenever: – an incoming datagram arrives. – An asynchronous error occurs. • Could be ICMP error (unreachable, invalid address, etc). • Could allow process to handle other tasks and still watch for incoming UDP messages. 39
  • 40. Signal Driven TCP • SIGIO occurs whenever: – an incoming connection has completed. – Disconnect request initiated. – Disconnect request completed. – Half a connection shutdown. – Data has arrived. – Data has been sent (indicating there is buffer space) – asynchronous error 40