SlideShare a Scribd company logo
What is a socket ?
It is an interface between
application layer and transport
layer within a host.



     CNP Seminar by Jithin P      2
Application Layer




                               Transport Layer
   Socket


     CNP Seminar by Jithin P                     3
Why socket ?
Kannadasan                             Yamuna
For Identification

                                   ?



         CNP Seminar by Jithin P                4
Why socket ?
Hostel Name + Room No
                                    IP address + Port number


                  Socket



          CNP Seminar by Jithin P                          5
listen()                      accept()



    CNP Seminar by Jithin P              6
listen()
 Called only by TCP server
 Performs two actions
         Convert the socket in to passive socket
         Specify the maximum number of connections the kernel
          should queue




                 CNP Seminar by Jithin P                         8
 For a listening socket the kernel maintains two queues
    An incomplete connection queue
         Waiting for 3-way handshake
   A complete connection queue
        Completed 3-way handshake




                 CNP Seminar by Jithin P                   9
3-way handshaking
              client                          server

  Connect called                                 Create entry on
                                                 incomplete queue


Connect returns

                                                 Entry moved from
                                                 incomplete queue to
                                                 complete queue




                    CNP Seminar by Jithin P                            10
int listen(int sockfd, int backlog)




         CNP Seminar by Jithin P      11
Questions ?
 What is the default size of backlog ?
 Which queue is longest one (complete/incomplete) ?
 What will happen when queue is full ?




              CNP Seminar by Jithin P                  12
accept()

                          Completed
                          connection queue




                           Incomplete
                            connection queue



    Arriving
    SYN

CNP Seminar by Jithin P                        13
accept()

int accept(int sockfd, socket addr, socket addrlen)

 If success return a brand new descriptor
 ie descriptor of connected socket.




             CNP Seminar by Jithin P                  14
References
 Unix Network Programming
       W.Richard Stevens
 Computer Networking a top down approach
       James F Kurose
 Wikipedia
 pubs.opengroup.org




                 CNP Seminar by Jithin P    15
Questions




CNP Seminar by Jithin P   16

More Related Content

PPT
Week5 (chap 5)
PDF
Los Angeles R users group - July 12 2011 - Part 2
PDF
Polyfoil Introduction
PDF
Rcpp
DOC
Lpc vocoder implemented by using matlab
PDF
Computational Techniques for the Statistical Analysis of Big Data in R
PDF
Ruby Sapporo Night vol.10
PPT
LECTURE-4 (Data Communication) ~www.fida.com.bd
Week5 (chap 5)
Los Angeles R users group - July 12 2011 - Part 2
Polyfoil Introduction
Rcpp
Lpc vocoder implemented by using matlab
Computational Techniques for the Statistical Analysis of Big Data in R
Ruby Sapporo Night vol.10
LECTURE-4 (Data Communication) ~www.fida.com.bd

What's hot (6)

PDF
From zero to gremlin hero - Part I
PDF
Welcome to International Journal of Engineering Research and Development (IJERD)
PPT
Ch04
 
ODP
Syntax-based Simultaneous Translation through Prediction of Unseen Syntactic ...
PDF
Introduction To Video Compression
PPT
I phone 10
From zero to gremlin hero - Part I
Welcome to International Journal of Engineering Research and Development (IJERD)
Ch04
 
Syntax-based Simultaneous Translation through Prediction of Unseen Syntactic ...
Introduction To Video Compression
I phone 10
Ad

Viewers also liked (6)

PPT
Domain name system
PDF
Presentation on Domain Name System
PDF
Internet and World Wide Web
PPT
Chapter 26
PPT
world wide web
PPT
Dns ppt
Domain name system
Presentation on Domain Name System
Internet and World Wide Web
Chapter 26
world wide web
Dns ppt
Ad

Similar to Listen and accept function (20)

PDF
Socket programming using C
PPT
Np unit1
PDF
Of the variedtypes of IPC, sockets arout and awaythe foremostcommon..pdf
PPT
Transmission Control Protocol (TCP) connection oriented
PPT
LECTURE-17(Socket Programming) Detailed.
PPT
DOCX
Final networks lab manual
PPT
Application Layer and Socket Programming
PDF
sockets SMTP Bmsce ppt information science and engineering
PPT
Concurrent Server and Iterative Server (1)-1.ppt
PDF
Gu3112991305
PPT
Point to-point-protocol
PPTX
Transport layer
PDF
Www ccnav5 net_ccna_4_chapter_3_v5_0_exam_answers_2014
PPT
Server and its both type concurrent and iterattive.ppt
PDF
Distributed systems short notes module 1
PDF
Application layer jain
PPTX
Network Programming-Python-13-8-2023.pptx
PPTX
Part4-reliable-tcp.pptx
Socket programming using C
Np unit1
Of the variedtypes of IPC, sockets arout and awaythe foremostcommon..pdf
Transmission Control Protocol (TCP) connection oriented
LECTURE-17(Socket Programming) Detailed.
Final networks lab manual
Application Layer and Socket Programming
sockets SMTP Bmsce ppt information science and engineering
Concurrent Server and Iterative Server (1)-1.ppt
Gu3112991305
Point to-point-protocol
Transport layer
Www ccnav5 net_ccna_4_chapter_3_v5_0_exam_answers_2014
Server and its both type concurrent and iterattive.ppt
Distributed systems short notes module 1
Application layer jain
Network Programming-Python-13-8-2023.pptx
Part4-reliable-tcp.pptx

More from Jithin Parakka (9)

PDF
Towards cashless economy
PPTX
Configuring D-link DSL-2730U Wireless N ADSL2+Router to connect BSNL broaddband
PPTX
Cloud Computing Tools
PPTX
Introduction to cloud computing
PPTX
PPTX
Semantic web tools
PPTX
Market oriented Cloud Computing
PPTX
Ubnutu Enterprise Cloud (EUC)
PPTX
self healing optical access network
Towards cashless economy
Configuring D-link DSL-2730U Wireless N ADSL2+Router to connect BSNL broaddband
Cloud Computing Tools
Introduction to cloud computing
Semantic web tools
Market oriented Cloud Computing
Ubnutu Enterprise Cloud (EUC)
self healing optical access network

Recently uploaded (20)

PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Basic Mud Logging Guide for educational purpose
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
master seminar digital applications in india
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
RMMM.pdf make it easy to upload and study
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
01-Introduction-to-Information-Management.pdf
PDF
Insiders guide to clinical Medicine.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Cell Types and Its function , kingdom of life
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
O5-L3 Freight Transport Ops (International) V1.pdf
Basic Mud Logging Guide for educational purpose
Abdominal Access Techniques with Prof. Dr. R K Mishra
master seminar digital applications in india
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
RMMM.pdf make it easy to upload and study
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Final Presentation General Medicine 03-08-2024.pptx
01-Introduction-to-Information-Management.pdf
Insiders guide to clinical Medicine.pdf
Microbial disease of the cardiovascular and lymphatic systems
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
O7-L3 Supply Chain Operations - ICLT Program
Cell Types and Its function , kingdom of life
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
2.FourierTransform-ShortQuestionswithAnswers.pdf

Listen and accept function

  • 1. What is a socket ? It is an interface between application layer and transport layer within a host. CNP Seminar by Jithin P 2
  • 2. Application Layer Transport Layer Socket CNP Seminar by Jithin P 3
  • 3. Why socket ? Kannadasan Yamuna For Identification ? CNP Seminar by Jithin P 4
  • 4. Why socket ? Hostel Name + Room No IP address + Port number Socket CNP Seminar by Jithin P 5
  • 5. listen() accept() CNP Seminar by Jithin P 6
  • 6. listen()  Called only by TCP server  Performs two actions  Convert the socket in to passive socket  Specify the maximum number of connections the kernel should queue CNP Seminar by Jithin P 8
  • 7.  For a listening socket the kernel maintains two queues  An incomplete connection queue  Waiting for 3-way handshake  A complete connection queue  Completed 3-way handshake CNP Seminar by Jithin P 9
  • 8. 3-way handshaking client server Connect called Create entry on incomplete queue Connect returns Entry moved from incomplete queue to complete queue CNP Seminar by Jithin P 10
  • 9. int listen(int sockfd, int backlog) CNP Seminar by Jithin P 11
  • 10. Questions ?  What is the default size of backlog ?  Which queue is longest one (complete/incomplete) ?  What will happen when queue is full ? CNP Seminar by Jithin P 12
  • 11. accept() Completed connection queue Incomplete connection queue Arriving SYN CNP Seminar by Jithin P 13
  • 12. accept() int accept(int sockfd, socket addr, socket addrlen)  If success return a brand new descriptor  ie descriptor of connected socket. CNP Seminar by Jithin P 14
  • 13. References  Unix Network Programming  W.Richard Stevens  Computer Networking a top down approach  James F Kurose  Wikipedia  pubs.opengroup.org CNP Seminar by Jithin P 15