Homework #1
(Total: 100 points) Due: Thursday, Sept. 13, 2006.
All numbered problems are from the course text by A. Leon-Garcia and I.
Widjaja.
All submitted work must be your own contribution and nobody else's!
Collaboration in homework is not allowed.
- [8 Points] Text, problem 1-1.
- [7 points]Text, problem 2-6.
- [10 points]Text, problem 2-10.
- [10 points]Text, Problem 2-19.
- [10 points]Text, Problem 2-25.
- [10 Points]Text, problem 2-47.
- [15 points] Host Name <---> IP ADDRESS. Write a program to return its IP address given a host name and vise versa.
- [15 Points]Describe the functionality and operations of Telnet.
One important feature of telnet is that it can be used to test other Internet protocols and connections in the layers higher than IP, such as HTTP, FTP, EMAIL. Test its usage and give detailed procedure for sending an email
to (yourself first and then to) our GA (at qim@cs.iupui.edu) using Telnet. Note: since telnet is not secure and is disabled on many servers, what needs to be done is that using ssh to log on to pegasus
server first and telnet to enigma.cs.iupui.edu for different protocols.
- [15 points] Nearest Mirror Location Problem. Write a
program in any language which connects to the nearest (in terms of
delay) server among a list of web servers.
You will be provided with
(i) a file to download and (ii) a file containing the list of mirrors
(up to 10 maximum) whose entries will be of the form:
http://mirror.hiwaay.net/CPAN/
http://www.cpan.org/
http://www.kernel.org/pub/mirrors/cpan/
http://www.perl.com/CPAN/
http://download.sourceforge.net/mirrors/CPAN/
http://www.neurogames.com/mirrors/CPAN
http://cpan.nitco.com/
http://csociety-ftp.ecn.purdue.edu/pub/CPAN
http://www.deao.net/mirrors/CPAN/
http://mirror.nyc.anidea.com/CPAN/
http://www.rge.com/pub/languages/perl/
http://ftp.epix.net/CPAN/
http://ftp.sedl.org/pub/mirrors/CPAN/
http://jhcloos.com/pub/mirror/CPAN/
http://mirrors.rcn.net/pub/lang/CPAN/
http://perl.Liquidation.com/CPAN/
http://cpan.llarian.net/
The file to be downloaded will be the first argument on the
command-line for the program and the file containing the mirrors will
be the second argument. Suppose you program is called `mirror-client',
and the list of mirrors is stored in the above format in a file
`mirror-list.txt' we should be able to run it as
mirror-client
index.html mirror-list.txt
A complete list of CPAN mirror sites is available at this
location. Note: You must access all the sites (up to 10 maximum) in
the list and maybe extract the first certain bytes such as 100 bytes
(or the size of the file if less than the certain bytes) and use that
delay to make your choice of the nearest mirror. The delay includes
your connection to the server not just reading these bytes. Some links
may be broken and unavailable, so remove these links from the list. If
the number of left working links is less than ten after removing the
unreachable links, you can add some links you choose to the list. You
may use the system call time() to estimate how long the download of
the initial bytes take. if you are using C or C++, Run 'man 3 ctime'
on pegasus.cs.iupui.edu for more information on time() system call. If
Java is used, you can even get nanoseconds by using System.nanoTime().
Output: the output of the program should be of the form
Nearest mirror location: http://ftp.epix.net/CPAN/
Estimated download time: 2 minutes 30 seconds
Hints:
- Here is a C program to access a web page using HTTP protocol (after you compile it, use a.out www.cs.iupui.edu /~xkzou/teaching/CS536/index.html to see that the part of index.html is retrieved). You can use it as a starting point for this program.
- You should read (and better test) all socket programs in the text book. it is very important for you to understand and master internet programming using socket, which will be very helpful for your career in the future.
Back to class webpage