Alan Kaminsky Department of Computer Science Rochester Institute of Technology 4486 + 2220 = 6706
Home Page
Data Communications and Networks I 4003-420-01/4005-740-01 Fall Quarter 2012
Course Page

4003-420-01/4005-740-01 Data Communications and Networks I
Module 6. Internet Applications -- Lecture Notes

Prof. Alan Kaminsky -- Fall Quarter 2012
Rochester Institute of Technology -- Department of Computer Science

Internet Requests For Comment (RFCs): http://www.ietf.org/rfc.html

Assigned port numbers: http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml


Remote Connection: Telnet

  • RFC 854
     
  • Telnet client
    • Opens a TCP socket connection to some host and port (default port 23)
    • Each character read from the keyboard is written to the socket
    • Each character read from the socket is written to the display
       
  • Telnet server
    • Listens for TCP socket connections on the well-known Telnet port number, 23
    • Each socket is handed off to a login process
       
  • Security
    • Telnet is insecure -- anyone can sniff the data going back and forth over the socket connection
    • Secure Shell (SSH) is an alternative that is secure
       
  • The Telnet client can connect to any port, not just port 23
    • This is useful for learning about Internet protocols, those that use textual encoding of messages


The Web: Hypertext Transfer Protocol (HTTP)

  • Architecture
    • Web servers, web clients (browsers)
    • HTTP requests, HTTP responses
    • TCP transport, textual wire protocol
    • Pull model -- client pulls data from server
    • The difference between HTTP and HTML
       
  • Standards
  • HTTP request message format
    • Method, request-URI, HTTP-version
    • HTTP GET request
    • From browser URL to TCP connection and HTTP GET request message
    • Demo: Telnet to localhost web server (↵ stands for the return key)
      $ telnet localhost 80↵
      GET /~ark/ HTTP/1.0↵

       
  • HTTP response message format
    • HTTP-version, status code, reason phrase
    • Header fields
    • Entity body
    • Demo: Try to get a nonexistent web page
      $ telnet localhost 80↵
      GET /~ark/garbage.html HTTP/1.0↵

       
  • Web browser operation
    • Get main object (URL)
    • Decide how to display page
    • Get embedded objects (URLs)
       
  • Web server operation
    • HTTP is stateless on the server side
       
  • Types of connections
    • Nonpersistent connections (HTTP/1.0, HTTP/1.1)
      • Each HTTP request/response is carried over a separate connection
      • Each HTTP request/response is performed one at a time
    • Persistent connections without pipelining (HTTP/1.1)
      • Each HTTP request/response to a certain server is carried over the same connection
      • Each HTTP request/response to this server is performed one at a time
    • Persistent connections with pipelining (HTTP/1.1)
      • Each HTTP request/response to a certain server is carried over the same connection
      • The HTTP request/response for the main document is performed first
      • Any HTTP requests for additional referenced documents (e.g., images) are performed all at once
    • Multiple simultaneous connections (HTTP/1.0, HTTP/1.1)
      • Each HTTP request/response to a certain server is carried over a separate connection
      • The HTTP request/response for the main document is performed first
      • Any HTTP requests/responses for additional referenced documents (e.g., images) are performed all at once
    • Number of round trip times (RTTs) needed to retrieve a web page with each type of connection
    • Persistent connections demo
      $ telnet localhost 80↵
      GET /~ark/ HTTP/1.1↵
      Host: localhost↵

      (main web page comes back)
      GET /~ark/fire.html HTTP/1.1↵
      Host: localhost↵

      (fire.html web page comes back)
    • Determining the end of each HTTP response message with persistent connections
      • Can no longer rely on socket input stream end-of-file to mark the end of the HTTP response message
      • Alternative: Content-Length header (/~ark/fire.html)
      • Alternative: Chunked transfer coding (/~ark/)
         
  • Web page caching
    • Conditional GET with If-Modified-Since: header
    • Demo: Telnet to localhost web server, get a .html page
      $ telnet localhost 80↵
      GET /~ark/menubar.html HTTP/1.0↵
    • Demo: Try again, include the If-Modified-Since: header
      $ telnet localhost 80↵
      GET /~ark/menubar.html HTTP/1.0↵
      If-Modified-Since: Tue, 07 Jan 2003 12:00:00 GMT↵
    • Caching in web clients
    • Caching in web cache servers
       
  • Session state: Cookies
    • RFC 2109
    • Demo: Use wget to retrieve www.google.com home page and print HTTP headers
      wget -S http://www.google.com/
    • How cookies are used to track state within one web server
      • Server sets a cookie in an HTTP response message header
      • Thereafter, browser sends the cookie in an HTTP request message header whenever the browser contacts that server again
      • User preferences
      • Shopping carts
    • How cookies are used to track state across multiple web servers
      • Banner ads
    • Privacy issues
       
  • Web page forms
    • Sending form data with HTTP GET requests
      • Example: www.google.com, main page
    • Sending form data with HTTP POST requests
    • Susceptible to eavesdropping
    • Secure HTTP (https:) -- encrypts data sent and received


Internet Email

  • Architecture
    • Mail servers, outgoing mail queues, incoming user mailboxes
    • User agents
    • Protocol for delivering email to user mailboxes: SMTP
    • Protocol for retrieving email from user mailboxes: POP3, IMAP
       
  • Simple Mail Transfer Protocol (SMTP)
    • RFC 2821
    • TCP based, textual protocol, port 25
    • Push model -- client pushes data to server (vs. HTTP's pull model)
    • Demo client program
      $ java SmtpDemo smtp-server.rit.edu 25 kaminsky.cs.rit.edu \
      'ark@cs.rit.edu' 'arkics@rit.edu' 'Test' 'This is a test'
      220 mxgate03.rit.edu ESMTP RIT Mail Gateway
      HELO kaminsky.cs.rit.edu
      250 mxgate03.rit.edu
      MAIL FROM: <ark@cs.rit.edu>
      250 Ok
      RCPT TO: <arkics@rit.edu>
      250 Ok
      DATA
      354 End data with <CR><LF>.<CR><LF>
      Date: Thu, 8 Oct 2009 11:45:59 -0400
      From: ark@cs.rit.edu
      To: arkics@rit.edu
      Subject: Test
      
      This is a test
      .
      250 Ok: queued as 154B7514005
      QUIT
      221 Bye
      
    • RFC 822: Email header lines (Date:, From:, To:, etc.)
    • Email ethics
      • SMTP does not authenticate the sender
      • You can put whatever you want after HELO and FROM
      • Enormous potential for abuse (spam)
      • Defense Against the Dark Arts
         
  • Multipurpose Internet Mail Extensions (MIME)
    • RFC 2045, RFC 2046
    • Defines how to transfer non-ASCII data
      • Due to a historical quirk, SMTP only transfers 7-bit ASCII data
      • Non-ASCII data must be encoded in the form of ASCII
      • Quoted printable encoding
      • Base 64 encoding
    • Defines how to interpret non-ASCII data
      • "MIME media types" or "MIME types"
      • Also used in HTTP
      • text/plain: Plain text
      • text/html: Web page
      • image/jpeg: Digital photo
      • image/png: Portable Network Graphics image
      • application/pdf: Adobe Acrobat file
      • application/postscript: PostScript file
      • application/x-ark-encrypted-grade-file: Nonstandard type
    • Defines how to include email attachments
      • MIME type multipart/mixed
      • Example from my inbox
         
  • Post Office Protocol (POP3)
    • RFC 1939
    • TCP based, textual protocol, port 110
    • Pull model -- client pulls data from server
    • Very simple: list messages, retrieve messages, delete messages
    • The user agent stores messages, manages mail folders, etc.
    • Most useful for a user who always uses the same machine to access email
       
  • Internet Mail Access Protocol (IMAP)
    • RFC 2060
    • Many more features than POP3
    • Maintains a hierarchy of mail folders on the server side
    • Useful for a user who uses different machines to access email


Internet Host Name Directory: Domain Name System (DNS)

  • RFC 1034, RFC 1035
     
  • UDP based, binary protocol, port 53
     
  • Architecture
    • Local name server
      • Each host is configured with the IP addresses (not host names!) of one or more local name servers
      • Host queries local name server to find the IP address for a host name
    • Root name servers
      • 13 scattered around the Internet
      • If the local name server can't answer the query, it delegates to a root name server
      • List of root name servers: http://www.root-servers.org
    • Authoritative name servers
      • One or more for each domain (like rit.edu)
      • Root name server delegates to an authoritative name server
    • Intermediate name servers
      • Some domains may have additional name servers
      • Root name server delegates to an intermediate name server, which eventually delegates to an authoritative name server
    • Query caching
       
  • DNS client program
    • host [options] name [server]
    • host -v ... -- Verbose output
    • host -r ... -- Don't do recursive queries
       
  • DNS functions -- demos
    • Host name to IP address mapping -- for mapping URLs
      host www.cs.rit.edu
      host -v www.cs.rit.edu
    • IP address to host name mapping
      host 216.239.51.101
    • Domain name to authoritative name server mapping
      host -t NS cs.rit.edu
      host -t NS rit.edu
    • Domain name to mail server name mapping -- for mapping email addresses
      host -t MX cs.rit.edu
      host -v -t MX cs.rit.edu
      • Gives mail server host name plus a numerical preference value (lower values are more preferred)
    • Load balancing
      host -t MX rochester.rr.com
      host -t MX rochester.rr.com

Data Communications and Networks I 4003-420-01/4005-740-01 Fall Quarter 2012
Course Page
Alan Kaminsky Department of Computer Science Rochester Institute of Technology 4486 + 2220 = 6706
Home Page
Copyright © 2012 Alan Kaminsky. All rights reserved. Last updated 08-Oct-2012. Please send comments to ark­@­cs.rit.edu.