Lab: DNS & Sockets

Introduction

In this lab, you will experiment with DNS and Sockets by creating code.

Goals

Acknowledgments

Parts of this assignment are adapted from exercises in Peterson & Davie (cs105), and in Kurose & Ross (cs125). The assignment also draws upon many other socket problems.

References

Logistics

Once again you are to work in Pairs.

If you are alone or the team is having difficulty creating code, email mike. There is code that can be provided to you.

Preparation

While KR references Python solutions, you are to write your solutions in C or CC. We strongly recommend that you and your partner brainstorm before codng. If you are having trouble attacking this problem, look at the socket and ports FAQs which can be found among the course FAQs.

Assignment

Part A: DNS

  1. You are to write a DNS access function, dnsaccess.c, that takes input from the command line a fully qualified DNS name and prints out ALL the returned IP addresses and/or names. You are creating your own version of NSlookup. To implement this function you are to use the new DNS system routines, e.g., getaddrinfo. dnsaccess.c, is a standalone program, the results of which you will use in implementing your echo.
  2. Once you are happy with your dnsaccess.c, fire up Wireshark and monitor a series of DNS inquires. Namely: Capture the DNS responses that are replies to your dnsaccess requests.
  3. Besides your code, the key output of this step is a printout of ALL the IP addresses that are returned by the local resolver.

What to Turn-in

Part B: Sockets

You are to create your own version of echo. Modify the client and server from my lecture (also available in CS 105 book, and everywhere else on the web) so that each time the client sends a line to the server, the server sends the line back to the client. Note: you also need some print statements as illustrated below. You (can) are to follow the lecture example with the following additions/clarifications:

What to Do and What to Turn-in

Assessment

To earn the equivalent of a B, complete parts A and B .

To earn an A, complete parts A, B, and provide WELL documented code, along with the discussion questions.

Advice

This assignment involves programming, so start early and ask for help if you run into trouble. Keep me posted on how it is going.

Lab Notebook

Besides including the specifics asked for in Parts A and B, and answers to the discussion questions..

EMAIL ME WHEN YOU HAVE FINISHED THE LAB.

In your writeup, copy and paste a small amount of output from the terminal showing that these programs work correctly. Mark this up using <verbatim></verbatim> tags.

Discussion Questions

  1. You were told to run the server on a different machine from the client. Why?
  2. What are the relative merits (pros and cons) of using TCP versus UDP for a multi-client chat room application?
  3. How much time did you spend on the three parts of this lab? In particular, how much time did you spend programming. CS 105 provides experience in C. I am curious how long this took for students without CS 105, i.e., only having had CS 70.

Mike Erlinger

Last Modified Thursday, 26-Sep-2019 16:21:03 PDT