Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Listen and accept function

2,664 views

Published on

This PPT is about TCP Listen and accept function and it is explaining three way handshaking also

Published in: Education, Technology
  • Login to see the comments

Listen and accept function

  1. 1. What is a socket ?It is an interface betweenapplication layer and transportlayer within a host. CNP Seminar by Jithin P 2
  2. 2. Application Layer Transport Layer Socket CNP Seminar by Jithin P 3
  3. 3. Why socket ?Kannadasan YamunaFor Identification ? CNP Seminar by Jithin P 4
  4. 4. Why socket ?Hostel Name + Room No IP address + Port number Socket CNP Seminar by Jithin P 5
  5. 5. listen() accept() CNP Seminar by Jithin P 6
  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. 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. 8. 3-way handshaking client server Connect called Create entry on incomplete queueConnect returns Entry moved from incomplete queue to complete queue CNP Seminar by Jithin P 10
  9. 9. int listen(int sockfd, int backlog) CNP Seminar by Jithin P 11
  10. 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. 11. accept() Completed connection queue Incomplete connection queue Arriving SYNCNP Seminar by Jithin P 13
  12. 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. 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
  14. 14. QuestionsCNP Seminar by Jithin P 16

×