• Therefore a mapping is required to change the domain name to the IP address. • Therefore a mapping is required to change the domain name to the IP address. Types of Domain
• There are various kinds of domain:
• Generic domains • Country domain • Inverse domain Name-to-Address Resolution Domain Name Server Domain Name Server Domain Name Server Domain Name Server DNS Server (dns_server.c): • The DNS server listens on a specified port for incoming connections using TCP sockets. • It reads domain-to-IP mappings from a file named database.txt and stores them in a structure called DNSRecord. • When a client connects, it receives a domain name from the client. • It searches for the domain in its database and sends back the corresponding IP address to the client. • If the domain is not found, it sends a message indicating that the domain is not found. DNS Client (dns_client.c): • The DNS client creates a TCP socket and connects to the DNS server running on the local machine (127.0.0.1) at port 8888. • It takes a user input for a domain name that the user wants to resolve to an IP address. • It sends the domain name to the server. • It receives the IP address from the server and prints it.