listen and accept function
DESCRIPTION
This PPT is about TCP Listen and accept function and it is explaining three way handshaking alsoTRANSCRIPT
CNP Seminar by Jithin P 2
What is a socket ?
It is an interface between application layer and transport layer within a host.
CNP Seminar by Jithin P 3
Application Layer
SocketTransport Layer
CNP Seminar by Jithin P 4
Why socket ?
For IdentificationKannadasan Yamuna
?
CNP Seminar by Jithin P 5
Why socket ?
Hostel Name + Room No
IP address + Port number
Socket
CNP Seminar by Jithin P 6
listen() accept()
CNP Seminar by Jithin P 8
listen()Called only by TCP serverPerforms two actions
Convert the socket in to passive socket Specify the maximum number of connections the
kernel should queue
CNP Seminar by Jithin P 9
For a listening socket the kernel maintains two queuesAn incomplete connection queue
Waiting for 3-way handshakeA complete connection queue
Completed 3-way handshake
CNP Seminar by Jithin P 10
client server
Connect called
Connect returns
Create entry on incomplete queue
Entry moved from incomplete queue to complete queue
SYN 100
SYN 240, ACK 101
ACK 241
3-way handshaking
CNP Seminar by Jithin P 11
int listen(int sockfd, int backlog)
CNP Seminar by Jithin P 12
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 13
accept()
Completed connection queue
Incomplete connection queue
Arriving SYN
CNP Seminar by Jithin P 14
accept()
If success return a brand new descriptor ie descriptor of connected socket.
int accept(int sockfd, socket addr, socket addrlen)
CNP Seminar by Jithin P 15
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 16
Questions