Data Communication and Computer Networking Notes
Data Communication and Computer Networking Notes
1. Introduction:
o DNS is the system that translates human-friendly domain names (e.g., www.google.com) into
IP addresses (e.g., 142.250.190.78), which computers use to identify each other on the
network.
o The design of DNS ensures that complexity is concentrated at the network edge, where client
machines and local DNS servers interact.
o DNS operates as an application-layer protocol, meaning it functions at the highest level of the
network protocol stack.
o It enables communication between:
▪ Hosts (e.g., your computer or phone): Initiating queries to resolve domain names into
IP addresses.
▪ DNS Servers: Responding to these queries with the required mappings.
2. Why Not Centralize DNS? Centralizing DNS would have several disadvantages:
o Single Point of Failure: If the central server fails, the entire Internet's DNS system would
collapse.
o Traffic Volume: A single server would be overwhelmed by the sheer number of DNS queries.
o Distant Centralized Database: A centralized server would increase latency for users located
far from it.
o Maintenance Challenges: Keeping one central server updated and secure is a massive task,
making it impractical.
A centralized DNS system does not scale effectively for the global Internet. That’s why DNS is
organizationally and physically decentralized which means millions of different organizations responsible
for their records.
3. DNS Services: DNS provides the following essential services:
o Hostname-to-IP Address Translation: Translates user-friendly domain names into machine-
readable IP addresses.
o Host Aliasing: Allows a single machine to have multiple aliases, such as www.cs.umass.edu or
cs.umass.edu.
▪ Canonical Name: The primary name for a host.
▪ Alias Names: Alternative names that map to the canonical name.
o Mail Server Aliasing: Maps a domain name to the IP address of the email server, ensuring
emails are routed correctly.
o Load Distribution: Distributes traffic across multiple servers by associating one domain name
with multiple IP addresses. This enables efficient load balancing for web services like
www.google.com.
4. Scalability:
o DNS's distributed and hierarchical structure makes it scalable.
o Examples of real-world usage:
▪ Comcast DNS Servers: Handle over 600 billion DNS queries per day.
▪ Akamai DNS Servers: Handle over 2.2 trillion DNS queries daily.
5. Distributed Database Implemented in a Hierarchy:
o DNS operates as a distributed database to handle the immense scale of the Internet.
o Instead of a single central server, DNS is structured in a hierarchical system consisting of:
▪ Root Servers: Root name servers are the topmost authorities in the DNS hierarchy,
serving as the contact-of-last-resort for resolving domain names. When lower-level
DNS servers (like local or TLD servers) cannot answer a query, root servers guide them
to the next step, such as the appropriate TLD server. They ensure the DNS system's
reliability by acting as the starting point for resolving queries across the Internet.
▪ TLD Servers: Manage specific domains like .com, .org, .edu, .net, or country codes like
.uk, .cn, .pk, .in and .jp.
▪ Authoritative Name Servers: Organization’s own DNS server(s), providing
authoritative hostname to IP mappings for organization’s named hosts (e.g.,
amazon.com or nyu.edu). It can be maintained by organization or service provider.
Example: A client wants IP address for www.amazon.com; 1st approximation:
- client queries root server to find .com DNS server
- client queries .com DNS server to get amazon.com DNS server
- client queries amazon.com DNS server to get IP address for www.amazon.com
SOCKET PROGRAMMING
A socket is a door between application process and end-end-transport protocol.
1. Socket Programming with UDP: It requires no connection between client and server. UDP transmitted
data may be lost or received out-of-order and it provides unreliable transfer of group of bytes. The main
features of socket programming with UDP are:
• no handshaking before sending data
• sender explicitly attaches IP destination address and port # to each packet
• receiver extracts sender IP address and port# from received packet
UDP Client Pseudo Code:
1. Include Python’s socket library
2. Create a UDP socket
3. Get user input
4. Attach server name and server port to message and send into socket
5. Read reply data (bytes) from socket
6. Print out received string
7. Close the socket
UDP Server Pseudo Code:
1. Include Python’s socket library
2. Create a UDP socket
3. Bind the socket to a specific port
4. Enter an infinite loop
5. Read from UDP socket into message, getting client’s address (client IP and port)
6. Send upper case string back to this client
2. Socket Programming with TCP: It enables communication between two systems (client and server) in a
reliable, connection-oriented manner.
Process:
• The server must start first, create a welcoming socket, and listen for incoming client
connections.
• The client initiates the connection by creating a socket and specifying the server's IP and port.
• Once the connection is established, data can flow bi-directionally in a byte-stream format.
• After communication, the connection is closed gracefully by both ends.
Server Handling Multiple Clients:
• A new socket is created for each client connection.
• The server distinguishes between clients using their IP address and port number.
TCP Features:
• Communication happens between one sender and one receiver.
• Establishes a connection (via a handshake) before data exchange to synchronize sender and
receiver states.
• Does not define message boundaries (works with streams of bytes).
• Allows bi-directional data flow
• MSS (Maximum Segment Size) defines the largest data segment size that can be sent.
• Reliable and in-order delivery.
• Connection termination ensures no data is lost during closure.
• Receiver acknowledges receipt of all data up to a certain point.
• Multiple packets can be sent before receiving an acknowledgment, improving efficiency.
• Includes congestion and flow control mechanisms to adjust the transmission rate.
• Ensures the sender does not overwhelm the receiver with too much data.
TCP Client Pseudo Code:
1. Include Python’s socket library
2. Create a TCP socket
3. Connect to the server using its address and port
4. Send data to the server
5. Receive the response
6. Print out received response
7. Close the socket
TCP Server Pseudo Code:
1. Include Python’s socket library
2. Create a TCP socket
3. Bind the socket to a specific port
4. Start listening for incoming TCP connections
5. Enter an infinite loop
6. Server waits on accept() for incoming requests, new socket created on return
7. Read bytes from socket
8. Send upper case string back to this client
9. Close connection to this client (but not welcoming socket)