COMPUTER NETWORKING

APPLICATION LAYER

SOCKET INTERFACE PROGRAMMING

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Single-thread TCP sockets are used for
A
One server-one client communications
B
One server-multiple client communications
C
e-mail distribution
D
social media
Explanation: 

Detailed explanation-1: -Yes-you need one socket for each connection. A socket is a client IP address + client port + server IP address + server port combination. If a client is talking to multiple servers, it is using multiple ports on the client machine. Each time you connect() a socket, you are allocating a new port.

Detailed explanation-2: -If there was only a single socket present to handle everything, closing down just one context or the other would be impossible; your only option would be close() the single socket and with it lose all of the state, even the parts you actually wanted to keep. That would be awkward at best.

Detailed explanation-3: -Irrespective of stateful or stateless protocols, two clients can connect to the same server port because for each client we can assign a different socket (as the client IP will definitely differ). The same client can also have two sockets connecting to the same server port-since such sockets differ by SRC-PORT .

There is 1 question to complete.