80 likes | 86 Vues
Implement a DNS server simulation using TCP sockets to handle client requests, cache DNS entries, and return results to clients.
E N D
Programming Assignment #1 • Simulate a DNS server using TCP • By utilizing Sockets! • Due Date: • Friday February 23, 2018 at 11:55p.m through Moodle website • Find project description and files you will need at Programming Projects Readings: Chapter 2: Sections 2.7 Project I Description CSci4211: Programming Assignment #1
What should we do? • Implement a typical Client/Server model. • Client gets input from user, and sends it to server. • The source codes of clients have been provided. • Server gets input from clients, and send DNS results back to clients. • This is what you need to code! • They communicate through sockets. CSci4211: Programming Assignment #1
How does server work? • Get DNS queries from clients. • Initially, the DNS cache should be empty. • Check if the query has been locally cached. • If so, fetch the IP address from cache. • Otherwise, check the DNSsystem(here we use the local machine DNS lookup) • add resulttoDNS_mapping.txt file (cache data). • WeassumethattherearedifferentIPaddressestowardsthesamehostnameinthecache.(e.g.Youtube.com) • One server can handle multiple clients. CSci4211: Programming Assignment #1
Things you may need to work on… • Socket Programming • File Operation • String Operation CSci4211: Programming Assignment #1
Scenario 1 2 1 4 3 2, 3 Step 1: Client contacts the local DNS server. Step 2: As the local cache is empty, contact the DNS server for theentry. (Here we use local machine DNS lookup) Step 3: DNS server return the DNSentry. Cache it on your local server. (Here we get the result of local machine DNS lookup) Step 4: Return the query result to the client. CSci4211: Programming Assignment #1
Scenario 2 1 2 Step 1: Client contacts the local server. Step 2: The requested host IP resolution is cached on the local server, just return it to the client!Iftherearemultipleaddressesforonehostname,youcanselectonerandomly. CSci4211: Programming Assignment #1
Things you may need to notice… • Python 2 vs Python 3 • Details about the cache. • Please read the project description carefully. • Let me know if you have any questions anytime. -W11-12F10-112-209Keller • Make your code east to read. -Pease add suitable comments, makes life more easy for all of us! CSci4211: Programming Assignment #1
Q&A CSci4211: Programming Assignment #1