Open In App

GATE | GATE CS 2008 | Question 16

Like Article
Like
Save
Share
Report

Which of the following system calls results in the sending of SYN packets?

(A) socket
(B) bind
(C) listen
(D) connect


Answer: (D)

Explanation: socket() creates a new socket of a certain socket type, identified by an integer number, and allocates system resources to it.
bind() is typically used on the server side, and associates a socket with a socket address structure, i.e. a specified local port number and IP address.
listen() is used on the server side, and causes a bound TCP socket to enter listening state.
connect() is used on the client side, and assigns a free local port number to a socket. In case of a TCP socket, it causes an attempt to establish a new TCP connection.

When connect() is called by client, following three way handshake happens to establish the connection in TCP.
1) The client requests a connection by sending a SYN (synchronize) message to the server.
2) The server acknowledges this request by sending SYN-ACK back to the client.
3) The client responds with an ACK, and the connection is established.

Sources: Berkeley sockets, TCP Connection Establishment and Termination

Quiz of this Question


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads