Midterm 2017, Problem 2, Q2

Midterm 2017, Problem 2, Q2

par Joyti Valérian Goel,
Number of replies: 1

I have a bunch of questions for Sockets in general and I will use Problem 2 - Q2 - Midterm 2017 to help me formulate them: In this question what are they implying by minimum, i don't see the relevance given they have given a specific context - how can the number of sockets differ? When a UDP socket is created... for e.g when client needs to communicate with DNS server... where is this UDP socket created... in the client's computer, the DNS' server or both? Is the TCP listening socket only created on the receivers side (one who received a connection request e.g. web server)? If so, why doesn't the client also need one given the receiver (e.g web sever) is sending back packets...

In reply to Joyti Valérian Goel

Re: Midterm 2017, Problem 2, Q2

par Katerina Argyraki,
Hi Joyti,

The number of UDP sockets may differ, because a process may use a single UDP socket to communicate with many other processes, or it may use a different UDP socket per process.

When a DNS client wants to talk to a DNS server, both processes use sockets: The DNS client creates and uses a UDP socket (on the local computer) to send and receive DNS messages to/from the DNS server process; the DNS server uses a UDP socket (that it has created in its own local computer) to receive and send DNS messages from/to DNS client processes (and also other DNS server processes). A process can never create a socket on a remote computer; it always creates/uses a socket on the local computer where it is running.

The purpose of the TCP listening socket is to accept connection-setup requests. This is why only the web server needs it (the web client/browser does not receive connection-setup requests).

A web client uses the same TCP connection socket to send and receive traffic to a web server. The web server uses its TCP listening socket to receive connection-setup requests; as soon as it accepts a new connection, it creates a new TCP connection socket and uses it both to send and receive data.

Clear?