• 2.1 Principles of network applications

  • 2.2 HTTP and the web

    • (2.5 covered in next lecture)
  • 2.6 Peer-to-peer architectures

  • 2.7 Socket programming

  • HTTP layer gives us:

    • Resource URLs
    • Response codes
    • Caching
    • Content types
    • Compression
  • Messages have arbitrary size

  • In general, the application layer defines and implements the architecture of the networked application

  • Two main classes of architecture:

    • Client/server
    • Peer-to-peer (P2)
  • Client-server architectures:

    • Scaling is determined by number of servers
    • Clients
      • Not always on
      • Address is ephemeral
      • Only listen after sending a request
    • Servers
      • Supposed to stay available
      • Predictable address
      • Always listening
  • Peer-to-peer architectures:

    • Infinitely scalable
    • Hosts are different, and come/go constantly
  • HTTP protocol

    • Data exchange built on top of TCP
    • Invented for web; now used for many other things
    • Stateless protocol
      • State communicated via cookies
    • Request consists of:
      • a URL
      • a request type (GET, POST, etc)
      • headers
        • Need at least the content length
      • optional body
    • Response consists of:
      • a response code (200, 301, 404, etc.)
      • headers
      • optional body
  • HTTP transaction steps

    1. Client creates socket; server accepts
    2. Client writes request to socket, and begins listening
    3. Server reads requests; eventually determines (via content length) that request is complete
    4. Server writes response to socket
    5. Client reads response from socket; eventually determines (via content length) that response is complete
  • SMTP (Simple Mail Transport Protocol)

    • Also built on top of TCP
    • Has separate protocols for clients and servers
    • Servers communicate peer-to-peer
    • Originally designed to be encoded by hand!