October 19th, 2021    

CISC 7332X


Networking PDFs
LAN Intro
Comp Networks
Fourier Mult
MAC Layer
LLC Layer
Flow Ctrl
Line Coding
Err Detect
Err Correct
Token LAN
Dist Sys
WAN Arch
Flash proxy

Spring 2021

Spring 2021 Midterm(key)
Spring 2021 Final(key)

Past Tests

Sample Midterm
Midterm S2004 grad
Midterm S2005
Midterm F2005
Midterm F2007
Sample Final

Sample Midterm

Midterm anskey

Final anskey

S2019 Midterm
S2019 Midterm anskey

Final anskey


You should EMAIL me homeworks, alex at theparticle dot com. Start email subject with "CISC 7332X HW# "

HW# 1 (due by 2nd class;): Email me your name, prefered email address, IM account (if any), major, and year.

HW# 2 (due by 3rd class): Write an Internet page grabber program. Your program should work similarly to UNIX program ``wget'' (or ``curl'')... only much simpler. Read the description of `wget' online. You specify a URL at command line, and your program connects and downloads a web-page. Tip: Internet search engine is your friend. Submit the program source code. [hw2 hint (feel free to use any programming language; highly recommend Java). Another hint: if you're doing this on Ubuntu, and can't find documentation for functions via "man" command, run this: apt-get install manpages-dev, which will install the linux programmer's manual pages; you'll be able to do: man gethostbyname to get documentation for the function, etc.].

HW# 3: In any language of your choice, implement a simple web-server. Your web-server should serve pages from some folder. You should be able to point your web-browser at the URL of your web-server, and see pages (and images) in that folder. This is not much different than writing a web-client. I recommend you use Java, since it's pretty easy to setup a basic server in that language---although you're free to use any language.

HW# 4: In this homework, you'll implement a simple Chat Server. Your server will start listening for connections. When a connection arrives, it will create a new thread to handle that connection (maintain a list of connections). When a string (line of text, your sockets are reading lines of text) arrives on any connection, the server will forward that string to all other connections. Pseudo code might look something like this:

List clients;
ServerSocket server = createserversocket;
    Socket client = server.acceptconnection();

//place that handles the thread
void run(){
        String line = readlinefromclient();

//some other function
void sendlinetoeveryone(string line){

The code isn't much longer than the pseudo code, but I'd like you all to figure it out on your own. Now, when you run the server, you should be able to telnet into that server. If more than one person telnets into that server, then everything one person types will be seen by everyone else. You can test it by running multiple Telnet instances (in different terminals), and seeing whether everything you type in one window appears in the other window. (you can google on how to install telnet client for your operating system).

If you're feeling creative, think of how you'd handle user names and nicknames in such a system. How would one person find out who is connected? How would they find out information about other users?

Submit just the source code via email.

HW# 5 (due by N+1 class;): In any programming language of your choice (C prefered), write an NTP client. NTP is Network Time Protocol. Your program sends a UDP packet to the server. The server responds with a similarly formatted UDP packet with the current time. A public ntp server is: This homework is part research part programming. Research part: Find the NTP specification, and determine what the UDP packet format is (google, etc.). Programming Part: Write a program to send the packet and recieve a response. When your program is executed, it will output the current time (recieved from NTP server) to standard output, in ``Wed Sep 24 07:29:23 EDT 2008'' format, (Note that since you're using UDP, not all packets will get through---so you might need to run the program a few times in order to get the correct time). You can lookup the format for the to/from message in ``NTP RFC'' (google for it)---the format is pretty simple. Your program should work similar to the unix utility ``ntptime''. Note that you should not use any "NTP" libraries---this homework is about creating your own UDP packet and sending it via the regular socket API. [hw hint].

HW# 6 (due by N+1 class;): In any language, build a DNS client. This is similar to HW5 (feel free to reuse the code from hw5). Accept hostname as command line argument. Construct a UDP packet with hostname, and send it to a DNS server. Recieve a UDP packet as response, and display the IP address on standard output. Note, your program must not use any DNS libraries (such as `gethostbyname' functions, etc.). ie: In this homework, you are writing your own DNS library.

HW# 7: Read Publish subscribe pattern wiki. Refactor (modify) your HW4 (chat server) to implement this pattern. The clients, upon connecting, will subscribe to the message bus. New messages are put on the bus. Implement a logging utility (to save all messages to a file), by having the logger subscribe to the message bus. Note that in this homework, you're implementing your own message bus, your own subscribe and publish logic, and your own message object. It's all just software you're writing. Submit the new code, etc.

HW# 8: Part1: This is half a page (few paragraphs) thinking-and-writing part. In many situations, you need to transmit a sequence of packets across the network. You generally cannot do much about big connection problems (lots of packets getting lost). But for situations when only a few packets are lost, perhaps there's a way to use error correction codes to `correct' the lost packet (without retransmission). Design a system and write up this design in a few paragraphs. You need to explain what correction scheme you will use, what will the sender be responsible for, how will the client know that packet is missing, and exactly how it will reconstruct the missing packet.
Part2: implement your scheme. Write 2 programs, "sender" and "reciever". The sender will get a block of data, cut it into `packets' (smaller files). The reciever program will take those smaller files and reconstruct the original block of data (even when 1 packet (file) is missing). You cannot just retransmit the original block of data multiple times.

HW# 9: In this homework, you'll write a few utilities. These should be flexible enough to run on schedule (cron, etc.). I highly recommend you use GPG for this (generate public/private key pair; do not keep private key anywhere near these programs), and command line email/ssh utilities, etc., don't recreate stuff if you can just use other programs/libraries. (I don't expect each of these to be longer than 10-20 lines of code).

Write a utility that accepts an "outbox" folder, "encrypted" folder, and "publickey" file. When a FILENAME.comp shows up in the "outbox" folder, your utility will encrypt the FILENAME using the public key and place it into the "encrypted" folder. Your utility then verifies that the encrypted file was created successfully (length is not zero, and there were no errors such as running out of disk space, etc.), your utility creates FILENAME.comp file in the "encrypted" folder, and erases the FILENAME.comp and FILENAME from the "outbox" folder. You then loop thorugh the "outbox" folder and erase all files (those without the .comp) with create date older than 30 days.

Write (another) utility that accepts an "encrypted" folder, "trash" folder, and list of email addresses. When a FILENAME.comp shows up in the "encrypted" folder, FILENAME is emailed to all the email addresses (as MIME attachment). Once you've confirmed you successfully emailed the file (no connection errors, etc.), you erase the FILENAME.comp file from encrypted folder, and move the FILENAME to "trash" folder. You then loop through the trash folder and erase all files with create date older than 30 days.

Then for entertrainment (not for homework), you can write another utility that nightly compresses your IMPORTANT_PROJECTS folder, into say IMPORTANT_PROJECTS.20141201062800.tar.gz, and places the file in the "outbox" folder. Verifies that compression completed successfuly (perhaps by uncompressing and checking; making sure size is not zero, etc.), and then also creates a IMPORTANT_PROJECTS.20131204062800.tar.gz.comp file.

Then for entertrainment (not for homework), have the program accept a list of SSH locations (host, folder, username, password or key), and ensure the file is replicated on each of those locations before locally moved to trash.

Note, it is a very good idea to ensure you only have 1 instance of each such program running at any given time. You can accomplish that by specifying another parameter such as "lockfile". Your program would then open the file and aquire an exclusive lock on it. If it can't aquire the lock, your program would exit (meaning another copy of your program is already running). This eliminates a lot of the race conditions that might cause corruption.

Submit the source code to the scripts, along with either a crontab file or instructions on how to setup the programs to run every minute (yes, every minute).

HW# 10: Re-implement HW#5 using ``Raw Sockets'' (also in C programming language, if possible). Specifically, this means that you will pass SOCK_RAW to `socket' function, instead of the SOCK_DGRAM as in HW5. Google for ``raw sockets programming tutorial'' and you'll find some help in doing this. The gist is that you'll be constructing the whole packet yourself (including the IP header, etc.), sending it, and recieving it. The resulting program should work -exactly- like HW5. Note to Windows users... depending on what version of Windows, or what service packs you have, this program may not work (using Windows socket API). I highly recommend you do this homework in a unix environment (ie: Linux). Again, Google is your friend. If not sure how to do something, email me.

Submit source code, along with instruction show to compile/run it.

© 2006, Particle