Download Protocols - Department of Computer Science, University of Northern

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

URL shortening wikipedia , lookup

URL redirection wikipedia , lookup

Transcript
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…
3
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
4
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
5
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)
6
SMTP
UA
UA
MTA
Internet
MTA
7
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)
8
SMTP Gateways
UA
UA
MTA/Gateway
MTA
MTA/Gateway
MTA
9
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
10
How SMTP works

The Basics
Keyword
Arguments
HELO
Sender’s Host Domain Name
MAIL FROM: Email Address of sender
RCPT TO:
DATA
QUIT
Email of Intended recipient
Body of the message
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 protected]
MAIL FROM:<[email protected]>
250 OK
RCPT TO:<[email protected]>
250 OK
13
Book’s Example (Cont.)
DATA
354 Start mail input; end with .
Blah blah blah…
.
250 OK
QUIT
221 Closing connection…
14
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."
15
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?
16
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
HTTP Request Operations
Operation
Description
OPTIONS
Request information about available
options
GET
Retrieve document identified in URL
HEAD
Retrieve metainformation about
document identified in URL
POST
Give information to server (e.g.,
submitting forms)
PUT
Upload document under specified URL
19
Status Codes








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
Demo
$> telnet www.cs.uni.edu 80
GET http://www.cs.uni.edu
…<Lots of HTML code here….>
21
Demo


Can we get a webpage?
Do all the images come along?
22