in Computer Networks edited by
9,440 views
27 votes

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

  1. $\textsf{socket}$

  2. $\textsf{bind}$

  3. $\textsf{listen}$

  4. $\textsf{connect}$

in Computer Networks edited by
9.4k views

3 Comments

2
1

Very nicely explained here!

https://notes.shichao.io/unp/ch4/

0

Subscribe to GO Classes for GATE CSE 2022

4 Answers

58 votes
 
Best answer

Answer is (D).

  • $\textsf{socket()}$   creates a new socket of a certain socket type, identified by an integer number, and allocates system resources to it.
  • $\textsf{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.
  • $\textsf{listen()}$ is used on the server side, and causes a bound TCP socket to enter listening state.
  • $\textsf{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 $\textsf{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.
edited by
by

2 Comments

edited by

The typical set of system calls on both the machines in a connection-oriented setup is shown in given flowchart.

  • accept() is used on the server side. It accepts a received incoming attempt to create a new TCP connection from the remote client, and creates a new socket associated with the socket address pair of this connection.
  • write() and read(), are used for sending and receiving data to/from a remote socket.
  • close() causes the system to release resources allocated to a socket. In case of TCP, the connection is terminated..
  • source:https://www.cse.iitk.ac.in/users/dheeraj/cs425/lec18.html
23
Nice Thank you !
0
0 votes
Connect is used for connection establishment . In connection establishment, first sender will send  SYN flag-synchronization flag which is used to synchronize and tell the receiver that sender is interested in connection establishment.
0 votes
To form a new TCP connection, we use CONNECT system call.
–7 votes
ans b)

1 comment

It is connect !
2
Answer:

Related questions