1 of 14

Section 1

Wherein we get to know the projects...

2 of 14

Your TAs

  • Melissa Winstanley
    • Office hours: Mondays @ 1:30 (before lecture)
  • Ryan Emmett
    • Office hours: Wednesdays @ 12:30
  • Both veterans

  • Prefer the GoPost over emails to us
    • That way, everyone can benefit from the answer
    • But anything personal (ex. code), do email

3 of 14

Section plan

  • A few minutes on the projects each week
    • Clarify requirements
    • Explain the LONG writeups
    • Give useful hints
  • Rest of the time on course material
    • Practice problems (exam prep)
    • Review of recent concepts
    • Introduce the next topic
    • Topics JZ doesn't get to in lecture
    • And of course, answering your questions

4 of 14

The projects

  • 5 projects, building upon each other
  • At the end, we'll be able to socially network
  • Improvements
    • More clearly-defined specifications for the project
    • Fewer build-related difficulties
    • Projects known before the quarter starts
    • Experienced TAs
  • But still some bugs
    • Have patience

5 of 14

Project 1

  • Experience with sockets
  • Comparison of UDP vs. TCP
  • Performance vs. reliability
  • Why we need message framing
  • Set up for the rest of the projects

6 of 14

Overview

  • Ping
    • Create a socket, send a packet, time the response
    • UDP and TCP
  • DataXfer
    • Testing rates of UDP and TCP transfer
    • Similar to ping, but do n trials and try to get a certain amount of data
  • DataXferService
    • The server side
    • Wait for connections, then send back a specific amount of data as fast as possible

7 of 14

Packages

  • Organize classes into unique namespaces
  • Allows easy JAR creation - grouping
  • Level of privacy: "package-private"

  • Mostly, you don't need to worry about them
    • Just be able to navigate them

8 of 14

Threads (DataXferRawService)

  • Why?
    • Constructor must return
    • But application must also wait for connections
    • Many ports to listen to
  • When do we want to create them?

9 of 14

Threads, V1

public class MyThread extends Thread {

public void run() {...}

}

...

Thread t = new MyThread();

t.start();

10 of 14

Threads, V2

public class Runner implements Runnable {

public void run() {...}

}

...

Thread t = new Thread(new Runner());

t.start();

  • See the Java Thread class

11 of 14

Threads ctd.

  • When do we want to shut down?
    • Infrastructure calls service's shutdown() method
    • But threads can be blocking
    • So they must timeout, then check whether to stop
  • This isn't built into the Thread class

12 of 14

Hints

  • UDP
    • DatagramSocket, DatagramPacket
  • TCP
    • Socket, ServerSocket
  • Learn to deal with errors (timeout, etc.)

  • Run client/server on the same machine to start
    • Minimize errors
  • Create a "runnable jar" and move it to another machine (w/config file)

13 of 14

Gotchas

  • Reminder: low vs. mid vs. high ports
  • NATing

  • Don't get intimidated
  • Get Eclipse set up now - don't deal with it during larger projects

14 of 14

Good luck!

  • From here, the lectures go down to the base of the network stack
  • Questions about the project?