COSC 6377 - Computer Networks

Fall 2012

MW 1:00-2:30pm at PGH376

InstructorOmprakash Gnawali

Homework - 0

Due: September 3, 2012

Data Format Standards

In this assignment, we will standardize data format to be exchanged by two programs written in two different programming languages. This will help us think about various aspects of designing a networked services. We will not be sending these standardized messages over the network (yet). Once we complete HW0, it is a small step to run these programs across the network.

Data

The first program (program1.c) written in C should ask the user to input her name and information regarding various courses she is taking. The program should save this data to a file called data.txt. The second program (program2.py) read this file and displays the information the screen.

We asked one of the students (Aaron Welch) to propose data standard for this course. Here is his proposal:

or every field (including the name of the student), any amount of whitespace preceding or following the field (e.g., non-whitespace characters) are not considered as part of the field itself. In other words, each field is effectively trimmed before being output by the Python program, so it is also safe (though not necessary) to include such whitespace when creating the file for increased readability. The first field in the file will contain the student's name, followed by a newline character at the end of the field (note: no carriage return character is used in linux). Each following line will contain a record of a single class, with the file ending after the last class. A valid record of a class will contain exactly seven fields separated by the pipeline character "|", in the following order: class number (such as COSC xxxx), class name, section number, days/times of the class, room building/number, instructor's name(s), and the number of units (hours) the class is worth.

example file:

Aaron Welch
COSC 6377 | Computer Networks | 01 | MoWe 1:00PM - 2:30PM | PGH 376 | Omprakash Gnawali | 3
COSC 7320 | Water Gun Fights in The Digital Era | 01 | MoWe 4:00PM - 5:30PM | PGH 501 | Roy Rodgers | 3
COSC 7366 | Rolly Chair Racing | 01 | TuTh 11:30AM - 12:30PM | PGH Halls | Speedy Gonzalez | 1

Running the program

Here is an example execution of program1:

./program1

Your name: Aaron Welch

Course code: COSC 6377

Course name: Computer Networks

Section: 01

Schedule: MoWe 1:00PM - 2:30PM

Location: PGH 376

Instructor: Omprakash Gnawali

Credit hours: 3

More course (y/n): y

...

(typying n terminates the program)

Here is an example execution of program2.py:

python program2.py

Name: Aaron Welch

Course: COSC 6377 - Computer Networks, 3 credit hours
Section: 01
When: MoWe 1:00PM - 2:30PM
Where: PGH 376
Instructor: Omprakash Gnawali
...

Compiling and Running

It is perfectly fine for you to work on your own Linux machine. We have provided each student with an account on a Linux machine called bayou.cs.uh.edu. Regardless of where you do your assignment, your assignment must compile and execute on bayou.

Submission

Put your source code into a folder with the name: uhid_hw0, where uhid is the prefix of your .uh.edu email address. There should be a single Makefile in that directory. When we run make on that directory, it should produce an executable called program1. There should also be program2.py in that folder. Put a README.txt in the directory describing anything unusual (e.g., limitations) of your implementation. Then, zip the directory and upload the zip file using Blackboard.