Protocols Networking CS 3470, Section 1 Sarah Diesburg
Applications • Applications need their own protocols • Just like we are writing our network programs with a certain specification so that any two randomly-chosen network programs may work together
Applications and Network Protocols • As an example, many browsers can interact with web servers • Firefox • IE • Chrome • Opera • Others…
Networking Application Protocols • Many specialized network application protocols are defined • For a list, just take a look at /etc/services • Today we will discuss two • Simple Mail Transfer Protocol (SMTP) used to exchange electronic mail • HyperText Transport Protocol (HTTP) is used to communicate between web browsers and web servers
Networking Application Protocols • Both HTTP and SMTP have protocols that specify the format of the data that can be exchanged • SMTP • RFC821 – Actual SMTP protocol • RFC822 – Companion protocol that specifies standard message format • HTTP • HTTP is the protocol for fetching web pages • HTML (HyperText Markup Language) is the companion protocol that defines the form of web pages
SMTP • Goal of SMTP is to transfer mail reliably and efficiently on TCP port 25 • Two main components • User Agents (UAs) prepare the message • Also called mail readers in the text • Mail Transfer Agents (MTAs) transfer the mail across the Internet • Also called mail daemons in the text (where daemon is just another word for process)
SMTP UA UA Internet MTA MTA
Gateways • Often the sender’s MTA doesn’t get to connect directly to the receiver’s MTA • Mail traverses one or more mail gateways • Stores and forwards email addresses • Example: Sending a mail to pizzahut.com first forwards to a global pizzahut gateway, then is sent to MTA specific to location (Cedar Falls area)
SMTP Gateways UA UA MTA/Gateway MTA/Gateway MTA MTA
RFC 822 • ARPA Internet Text Messages • Defines format of the messages being exchanged • Messages have two parts: header and body • Both parts are represented in ASCII text • Attachments like pictures are encoded • ASCII protocols can be tried by humans running telnet! • $> telnet some.mail.server 25
How SMTP works • The Basics
Status Codes • The Server responds with a 3 digit code that may be followed by text info • 2## - Success • 3## - Command can be accepted with more information • 4## - Command was rejected, but error condition is temporary • 5## - Command rejected, Bad User!
Book’s Example $> telnet mail.cs.princeton.edu 25 HELO cs.princeton.edu 250 Hello email@example.com MAIL FROM:<Bob@cs.princeton.edu> 250 OK RCPT TO:<Alice@cisco.com> 250 OK
Book’s Example (Cont.) DATA 354 Start mail input; end with . Blah blah blah… . 250 OK QUIT 221 Closing connection…
Before we move on… • Use of Computer Resources poicy: http://www.uni.edu/policies/954 • "Unauthorized or inappropriate use of the University of Northern Iowa computing resources is prohibited and is grounds for sanctions which can include suspension or loss of computing privileges, disciplinary action or, in extreme cases, legal action."
Demo • Let’s find UNI’s SMTP server… • Can we send from any address (even fake ones)? • Can we send to anybody? • What’s in the headers?
HTTP • Hypertext Transport Protocol • Protocol used for communication between web browsers and web servers • TCP port 80 • RFC 1945 • ASCII protocol • This means we can use our good friend, telnet! • $> telnet some.webserver.com 80
HTTP - URLs • URL • Uniform Resource Locator • protocol (http, ftp, news) • host name (name.domain name) • port (usually 80 but many on 8080) • directory path to the resource • resource name • http://xxx.myplace.com/www/index.html • http://xxx.myplace.com:80/cgi-bin/t.exe
200 OK 201 created 202 accepted 204 no content 301 moved perm. 302 moved temp 304 not modified 400 bad request 401 unauthorized 403 forbidden 404 not found 500 int. server error 501 not impl. 502 bad gateway 503 svc not avail Status Codes
Demo $> telnet www.cs.uni.edu 80 GET http://www.cs.uni.edu …<Lots of HTML code here….>
Demo • Can we get a webpage? • Do all the images come along?