CMPU-375: Networks

Vassar College, Fall 2007

Syllabus / Home Page

Throughout the semester this web page will be updated with important course information.  Please check it regularly.

This info on the Web:http://www.cs.vassar.edu/~cs375/
Professor: Marc Smith (my homepage
Office: OLB 122
Office hours: Mon / Thu,  3:00-5:00pm,  and by appointment
Phone: 437 7497
Email: mlsmith at cs dot vassar dot edu
Class meeting times: Tue / Thu,  1:30-2:45pm,  OLB 105



Resources:


Text: Graba, Jan. An Introduction to Network Programming with Java, 2nd ed. Springer. Copyright © 2007.

Prerequisite(s): The official prerequisite for this course is CMPU-203, but if you've also taken CMPU-224 (Computer Organization), CMPU-334 (Operating Systems), or CMPU-377 (Parallel Programming) you'll find that topics introduced in those courses are built upon in this course.

Overview:
A course titled "Networks" could emphasize a wide variety of topics, some of which are mentioned in the catalog description of this course, which is now over eight years old: eight computer years is a long time! There are topics mentioned in the catalog description that will not be covered, or only covered minimally, so that more current network-related topics can be introduced.

We will cover some theoretical aspects of networks, but the focus of this course is network programming. The programming language we will use is one you're already familiar with: Java. In previous CS courses, we've emphasized Java as an object-oriented programming language, which is true, for the most part. But there is much more to Java than its OO features. Java was equally designed to be a network-centric programming language. Its introduction coincided with the introduction of the World Wide Web, which many would characterize as the killer app of the Internet. Java and the WWW owe much of their respective growth and popularity to each other. In learning about network programing, we will explore many of Java's network-centric language and library features.

It is not possible to cover the depth and breadth of computer networks in a single semester course. The list of topics I've chosen to cover may be longer than time permits in one semester. We will make adjustments along the way, and I will solicit your input in prioritizing topics, if necessary.

A few words about the text I chose: There is no shortage of computer networking texts. After carefully surveying over a half dozen well-regarded textbook candidates, I chose Jan Graba's An Introduction to Network Programming with Java for several reasons. First, the author covers a sufficient amount of network theory to support a wide variety of network programming approaches. Second, the author chose the Java programming language to illustrate network programming, which today is arguably the best choice of language for this application domain. Third, the author's selection of Java 1.5 language and package capabilities should lead to exciting programming assignments throughout the semester. That said, no one book is perfect. We will not cover everything in the text (e.g., the chapter on CORBA), and I will supplement topics where I believe more background will be beneficial (e.g., relational databases in support of the chapter on Java Database Connectivity). In the end, I hope you will agree, Graba's text is an excellent choice for this course.

Goals: The following are the goals of this course:
  1. Understand the client/server architecture upon which most network applications are based (including peer-to-peer)
  2. Be familiar with common network terminology, communication protocols, and the modern 4-layer network model used by Internet applications
  3. Learn about the relational database model and its query language 
  4. Gain practical experience using Java's network and database access capabilities
  5. Develop the skills necessary to become a competent network programmer
Topics / Course Outline: We will discuss the UDP and TCP communication protocols so that we may implement Java network applications that use these protocols. We will study client-server architectures as a common design pattern for network applications, and explore how Java programs running on different computers (and consequently, within different JVMs) communicate and coordinate with each other. Some of the Java topics we'll cover that you may not have seen before include multithreading, object serialization, and random-access file I/O, to name a few. Time permitting, we will cover as many of the following advanced Java/network topics as possible: network accessible databases (using JDBC), Servlets, JavaServer Pages (JSPs), JavaBeans, multimedia applications (that provide images and sound), and applets.

Network Programming Environment: We will use the computers in the Asprey Lab as our network application test bed. These computers are only accessible behind the Computer Science Department's firewall. More than in other CS courses you've taken, you may find it more convenient to work on your assignments in the Asprey Lab. The workstation DNS names are in the range between [al69...al82].cs.vassar.edu. You can access these machines directly (via ssh or sftp) from inside the firewall. Outside the firewall, you must first connect to mote33.cs.vassar.edu. From there you can access the rest of the machines behind the firewall.

My promise / Your participation / Request for feedback: I'll try to make the material as easy to digest as possible, but I need your help identifying the things that are confusing you. Ask questions in and out of class. If you have a question, you can bet you're not the only one in class with that question. Answering my and your classmates' questions is a great way to gauge your own understanding of a topic or concept. Please feel free to raise any concerns or complaints about the course directly with me. You are also wecome to send me your concerns anonymously. I will gladly respond to them. I also encourage you to let me know when something about the course is going well--I'll try to keep doing it.

Attendance: We are a community of learners, but we must be present to help one another. You provide a unique and valuable contribution to every class. The questions you ask help us all understand better the course material. Missing class deprives me and your classmates of your insights and understanding. So, please notify me before any classes you know you will miss. I worry about you when you're not present. In cases of unforeseen absenses (e.g., illness, injury, family emergency), please arrange for official notes of explanation (e.g., from the Health Service or the Dean of Studies Office) to be sent to me. Remember, part of your grade (5%) is based on participation, and you must be present to participate. Excessive absences tend to hurt one's overall performance in this class.

Advice: Keep up with the reading and assignments. Topics tend to build on one another. Missing one lecture may preclude fully understanding the next, so do your best to attend every lecture. Make arrangements with a classmate to copy material you miss when you can't attend, and don't hesitate to ask me questions whenever they arise. Visit me (often) during office hours--I love to discuss this stuff.

Coursework and Grades: To assess your understanding of the topics presented in this course, there will be frequent programming assignments, one midterm project (due date already set--see below and schedule), and a final project (due the third day of the final exam period). Late assignments will not be accepted once solutions have been discussed in class. Your final grade for the course will be calculated according to the following distribution of coursework:

5% Participation
45%  Programming Assignments
25%  Midterm Project (due: Oct 11)
25%  Final Project (due: Dec 17)

Based on the weighted average of your graded coursework, your letter grade will be determined according to the standard 90, 80, 70, 60 cutoffs. For example, 90% or above is an A; 80% or above, but below 90%, is a B; etc. Pluses or minuses may be added at the instructor's discretion.

Academic Integrity: Don't cheat. Read Originality and Attribution: A guide for student writers at Vassar College. Moreover, the guidelines that apply to writing in general, apply equally to the writing of computer programs. Copying someone else's code without attribution amounts to plagiarism. Likewise, give proper attribution for the help you receive. School policy dictates instructors must report all suspected incidents of cheating to their department chair. Did you read the previous sentence? Please don't put yourself or me in that position. When in doubt, ask me before seeking any help from another source.

Students with disabilities: Academic accommodations are available for students with disabilities who are registered with the Office of Disability and Support Services. Students in need of disability accommodations should schedule an appointment with me early in the semester to discuss any accommodations for this course which have been approved by the Office of Disability and Support Services, as indicated in your DSS accommodation letter.

Schedule: readings, topics, assignments

Week # (of) Tue Thu
  1. (Aug 27) Aug 28

No class




Aug 30 (Thu)
First class

Introductions
Course overview
Ch. 1: Basic Concepts, Protocols and Terminology  PDF  
Reading assignment: Ch. 1 and 2
  2. (Sep 3) Sep 4

Ch. 1: Basic Concepts, Protocols and Terminology  PDF  
Ch. 2: Starting Network Programming in Java  PDF  

Recap:
  • finished ch. 1 topics
  • began covering ch. 2 topics
    • Java's INetAddress class
    • TCP Sockets
  • hands-on in the Asprey lab
    • ensured everyone had access to the Linux boxes
    • everyone could download code, compile, and execute Java programs from the command line
    • ran the book's TCPEchoServer and
      TCPEchoClient programs, in original form,
      from separate shells on the same machine. 
    • edited the code so we could run the server on
      one machine, and the client on another (i.e., replaced INetAddress.getLocalHost() with INetAddress.getByName("alXX").
Sep 6

Ch. 2: Starting Network Programming in Java (cont'd)  PDF  

Lessons learned from last class:
  • Marc: leave more time for hands-on!  :-)
  • Students: if you're not already familiar with one, learn how to use a real programmer's text editor, like vim or emacs.
  • Marc and students: when running a server program, we should have pre-assigned machines in the Asprey lab.
Here are our machine assignments:
    Marc (al69)
    Alison (al70),  Olivia (al71),  Catlin (al72),  Michael (al73),  
    Felix (al74),  Marius (al75),  Brian (al76),  Andrew (al77)


Programming Assignment 1 -- due: Fri, Sep 14


  3. (Sep 10) Sep 11

Ch. 2: Starting Network Programming in Java (cont'd)

Recap:
  • network programming with GUIs
    • time server example with remote GUI client
    • use port 1313 (or anything > 1024) instead of 13 to avoid runtime exception
    • use of layout manager to easily place buttons, text fields, etc., on screen
    • notion of event listeners to respond to user-generated events (e.g., clicking on a button)
    • Java language feature: anonymous inner classes
      • a unnamed class definition of limited scope
      • like lambda in Scheme -- only more cumbersome
  • port scanning program
    • a way to identify which ports are "active" (have a server listening for requests) at a given location
    • extended range of scan from book's example to see port 1313 being used
Reading assignment: Ch. 3













Sep 13

Ch. 3: Multithreading and Multiplexing

Assignment 1 -- due tomorrow (Friday)

Recap: (class outside)
  • implications of multithreading
    • nondeterminism, race hazards, 
    • synchronization, locks, deadlocks
  • Java multithreading support
    • extend class Thread
    • implement Runnable interface
    • both approaches require /implementing run(), which is invoked indirectly via the start() message
    • synchronization
      • all objects have a hidden lock
      • synchronized keyword: for methods and code blocks
      • wait(), notify(), notifyAll()
        (we need to discuss these methods more)
  • walk-throughs: sample code from chapter
    • ThreadShowName and ThreadHelloCount
    • RunnableShowName and RunnableShowCount
    • MultiEchoServer:
      • server spawns a ClientHandler for each client request
      • ClientHandler communicates directly with client on behalf of the server
      • server doesn't block: each ClientHandler is its own thread of execution
Assignment 2 -- Exercise 3.5 from text, pp. 88-89.
                       -- implement a multiclient chatroom
                       -- server and client both multithreaded
                       -- additional details to come
                       -- due: Fri, Sep. 21
  4. (Sep 17) Sep 18

Ch. 3: Multithreading and Multiplexing (cont'd)
Reading assignment: Ch. 4
Sep 20

Ch. 4: File Handling

  5. (Sep 24) Sep 25

Ch. 4: File Handling (cont'd)
   Lecture notes: PDF  
   Code walk-through: Serialise.java  



Sep 27

Ch. 4: File Handling (finish up)
   Vectors, and Serialization: code walk-throughs

Midterm project assigned: description  
  Due: Thu, Oct 11

Reading assignment: Ch. 5
  6. (Oct 1) Oct 2

Assign2 handed back: discussion...

Ch. 5: Remote Method Invocation (RMI)

Oct 4

Ch. 5: Remote Method Invocation (RMI)

Supplemental lecture: Relational databases
Reading assignment: Appendix A
  7. (Oct 8) Oct 9
Supplemental lecture: Relational databases

Today:
  • Last time we ran into trouble running the Bank2 example from Ch. 5: RMI. Furthermore, we didn't get to see the example run across machines in the Asprey lab. 
    • Let's rerun the example
    • Note for running RMI applications under Linux: need to use a command-line parameter when launching the Server app, e.g.
e.g.,
$ java -Djava.rmi.server.hostname=143.229.6.nn Bank2Server
where nn is the final octet of your server machine in the Asprey Lab.
  • Relational databases store data in tables
  • These tables contains rows of data called tuples
  • The table columns are the fields that describe the tuples' fields
  • Fields in one table can be related to fields in another table. 
  • Each table has a key that uniquely identifiies each tuple in the table
  • Organizing tables in a way that minimizes duplicate data and facilitates keeping data up-to-date is the process of Data Normalization.
  • Here's a link to Marc Rettig's famous poster, the "5 Rules of Data Normalization": PDF  
    • The original poster is hanging up in my office
    • Order your own:  here   
  • A more modern description of data normalization is found here: http://www.datamodel.org/NormalizationRules.html

Appendix A: Structured Query Language (SQL)
Reading assignment: Ch. 7
Ch. 7: Java Database Connectivity (JDBC)
Oct 11

Midterm project due today, or Fri, Oct. 12, 5pm,
   or as soon thereafter as possible...

Today:
  • MySQL tutorial + handouts + demo
  • Exercise: Music database (on board)
    • what tables?
    • what relationships?
    • what queries?
  • Define in MySQL
       
  • MySQL will be installed in Asprey Lab after the break
  • Install it on your own computer to play with, if you like
  • We'll do more after the break: 
    • web-based access to MySQL database
    • Chapter 7: Java Database Connectivity (JDBC)




















 
  8. (Oct 15) Oct 16

October break
Oct 18

October break
  9. (Oct 22) Oct 23

Welcome back!  We're in the lab today.

Handouts for two MySQL / Netbeans tutorials

Ch. 7: Java Database Connectivity (JDBC)
Oct 25

CIS Tour scheduled for beginning of class!
Come to class and we'll walk over as a group.

Ch. 7: Java Database Connectivity (JDBC)
10. (Oct 29) Oct 30

Today:
  • Midterm projects handed back
    • show and tell?
    • you guys did a really great job!
  • Everyone finished with Netbeans tutorial?
  • Next class: Ch 8 Servlets
    • We'll use Netbeans to start/stop our Tomcat server and for MySQL database access
    • So that's why I want to make sure your Netbeans tutorials are complete...

Reading assignment: Ch. 8
Nov 1

Ch. 8: Servlets
  Lecture notes:  PDF  












11. (Nov 5) Nov 6

Ch. 8: Servlets
  Lecture notes:  PDF  

HW: see last page of lecture notes above
         Due: Fri, Nov. 9, 5pm


Nov 8

Ch. 8: Servlets
  • Sec. 8.8: Sessions
  • Sec. 8.9:  Cookies
HW: due tomorrow

12. (Nov 12) Nov 13

Ch. 8: Servlets
(and MySQL database access)
Lecture and Lab:  PDF   (last four slides, pp. 7-8)


















Nov 15

Ch. 8: Servlets
(and MySQL database access)
Lecture and Lab

Managing Tomcat:
  • To ensure Tomcat environment set upon login, create an alias to your .bashrc (one-time only):
    $ ln -s .bashrc .bash_profile
       
  • Note: don't run Tomcat on mote33
       
  • To check if Tomcat running:
    $ ps aux | grep tomcat 
       
  • What to do if shutdown.sh doesn't work:
    $ pkill -4 java    
    or
    $ pkill -4 -f tomcat
       
  • If all else fails, email me or Greg (priestdo@cs.vassar.edu)
       
13. (Nov 19) Nov 20

Final Project planning

My idea: VBay (an online auction site for Vassar)

Brainstorm and pitch ideas
  • for VBay
  • for your proposed projects
  • database design
  • VBay servlets and web pages (interface design)
Nov 22

Thanksgiving recess
14. (Nov 26) Nov 27

Ch. 12: Multimedia
Reading assignment: Ch. 13

Nov 29

Ch. 12: Multimedia

Student Evaluations handed out
15. (Dec 3) Dec 4

Requested topic:
Ch. 9 JSPs

Final Project (in lieu of examination) assigned:
   Due second day of exam period: Monday, Dec 17
Dec 6 (Last class)

Wrap-up



16. (Dec 10) Dec. 11

Study week
Dec 13

Final Project due: Sunday, Dec 16, 5pm.

Final Project Demonstrations / Pizza Party
Sunday, Dec 16
5pm -- 7pm
OLB 105
17. (Dec 18) Dec. 18

Final Project: due Sunday, Dec 16