1,415 views
3 votes
3 votes
When a TCP data packet arrives at a host, the operating system’s network stack uses the following fields to direct the segment to the appropriate socket:

I. Transport protocol number (i.e., “TCP” or “UDP”)
II. Destination IP address
III. Source port number
IV. Destination MAC address
(A). Only I
(B) Only I, II
(C) Only I, II, III
(D) Only II, III

1 Answer

1 votes
1 votes

Socket needs IP and Port No. So answer will be D .

On the client-side: The client knows the hostname of the machine on which the server is running and the port number on which the server is listening. To make a connection request, the client tries to rendezvous with the server on the server's machine and port. The client also needs to identify itself to the server so it binds to a local port number that it will use during this connection. This is usually assigned by the system.

A client's connection request

If everything goes well, the server accepts the connection. Upon acceptance, the server gets a new socket bound to the same local port and also has its remote endpoint set to the address and port of the client. It needs a new socket so that it can continue to listen to the original socket for connection requests while tending to the needs of the connected client.

The connection is made

On the client side, if the connection is accepted, a socket is successfully created and the client can use the socket to communicate with the server.

The client and server can now communicate by writing to or reading from their sockets.

Related questions

27 votes
27 votes
4 answers
3
34 votes
34 votes
3 answers
4
go_editor asked Sep 28, 2014
11,292 views
Which of the following socket API functions converts an unconnected active TCP socket into a passive socket?$\textsf{connect}$$\textsf{bind}$$\textsf{listen}$$\textsf{acc...