70
1 ITC242 – Introduction to Data Communications Internet Based Applications

1 ITC242 – Introduction to Data Communications Internet Based Applications

  • View
    216

  • Download
    0

Embed Size (px)

Citation preview

1

ITC242 – Introduction to Data Communications

Internet Based Applications

2

Last Week

TCP/IP and OSI

• Describe the definition of a protocol;

• Discuss the need and benefits of using protocol architectures;

• Describe the TCP/IP protocol architecture

• Describe the OSI reference model.

3

Topic 6 Internet Based Applications

Learning Objectives• describe electronic mail and the basic

function of SMTP• explain the need for MIME• explain the role of HTTP in the operation

of the Web• describe the functions of proxies,

gateways and tunnels in HTTP• recognise the role of SIP

4

Question

Which layer of OSI we will study in this class?

5

Layering: The OSI Model

Session

Network

Link

PhysicalPhysicalPhysical

Application

Presentation

Transport

Network

Link Link

Network

Transport

Session

Presentation

Application

Network

Link

Physical

Peer-layer communication

layer-to-layer communication

Router Router

1

2

3

4

5

6

7

1

2

3

4

5

6

7

6

Electronic Mail Features

• Message Preparation– Word processing– Annotation

• Message Sending– User directory– Timed delivery– Multiple addressing– Message priority– Status information– Interface to other facilities

• Message Receiving– Mailbox scanning– Message selection– Message notification– Message reply– Message rerouting

7

Public vs Private Email

• Public– Provided by a 3rd party vendor– Available over one or more public networks– Examples: MCI Mail, AOL

• Private– Integrated with user’s computer equipment– Often part of an integrated tool, eg PROFS– Used for internal messaging

• Internet mail does not fit into either of these categories; it is a transfer mechanism rather than a contained system

8

Electronic Mail

Three major components: • user agents • mail servers • simple mail transfer protocol:

SMTP

User Agent• a.k.a. “mail reader”• composing, editing, reading mail

messages• e.g., Eudora, Outlook, elm,

Mozilla Thunderbird• outgoing, incoming messages

stored on server

user mailbox

outgoing message queue

mailserver

useragent

useragent

useragent

mailserver

useragent

useragent

mailserver

useragent

SMTP

SMTP

SMTP

9

Electronic Mail: mail servers

Mail Servers • mailbox contains

incoming messages for user

• message queue of outgoing (to be sent) mail messages

• SMTP protocol (see the next)

mailserver

useragent

useragent

useragent

mailserver

useragent

useragent

mailserver

useragent

SMTP

SMTP

SMTP

10

SMTP [RFC 2821]

• uses TCP to reliably transfer email message from client to server, port 25

• direct transfer: sending server ( “client”) to receiving server( “server”)

• three phases of transfer– handshaking (greeting)– transfer of messages– closure

• command/response interaction– commands: ASCII text– response: status code and phrase

• messages must be in 7-bit ASCII

11

Scenario: Alice sends message to Bob

1) Alice uses UA to compose message and “to” [email protected]

2) Alice’s UA sends message to her mail server; message placed in message queue

3) Client side of SMTP opens TCP connection with Bob’s mail server

4) SMTP client sends Alice’s message over the TCP connection

5) Bob’s mail server places the message in Bob’s mailbox

6) Bob invokes his user agent to read message

useragent

mailserver

mailserver user

agent

1

2 3 4 56

12

Sample SMTP interaction S: 220 hamburger.edu C: HELO crepes.fr S: 250 Hello crepes.fr, pleased to meet you C: MAIL FROM: <[email protected]> S: 250 [email protected]... Sender ok C: RCPT TO: <[email protected]> S: 250 [email protected] ... Recipient ok C: DATA S: 354 Enter mail, end with "." on a line by itself C: Do you like ketchup? C: How about pickles? C: . S: 250 Message accepted for delivery C: QUIT S: 221 hamburger.edu closing connection

SMIT Client: CSMIT server: S

Status code: 220 Service Ready250 OK421 Service Not Available

Sending message

Commands: HELO(HELLO), MAIL FROM,RCPT TO, DATA, QUIT

13

SMTP Connection Setup

• Sender opens TCP connection to receiver• Receiver acknowledges connection with

“220 Service Ready” or “421 Service Not Available”

• If connection is made, sender identifies itself with the “HELO” command

• Receiver accepts identification with “250 OK”

14

SMTP Mail Transfer

• MAIL command identifies originator, provides reverse path for error reporting

• RCPT commands identify recipient(s) for message– Receiver has several positive or negative responses

to RCPT– Sender will not send message until it is sure at least

one copy can be delivered

• DATA command transfers message

15

SMTP Connection Closing

• Sender sends a QUIT command to initiate TCP close operation

• Receiver sends a reply to the QUIT command, then initiates its own close

16

Single System E-Mail

17

Single System E-Mail

• Only allows users of a shared system to exchange messages

• Each user has unique identifier and mailbox

• Sending a message simply puts it into recipients’ box

• Example: AOL

18

Multiple Systems E-Mail

19

Multiple Systems E-Mail

• Distributed system enables mail servers to connect over a network to exchange mail

• Functions split– User agent handles preparation, submission, reading,

filing, etc– Transfer agent receives mail from user, determines

routing, communicates with remote systems

• Interconnection requires standards

20

Request For Comments

• Form the basis of the Internet's technical documentation. • Conceptually, the Internet as a layered series of

protocols, each is documented by one or more RFCs. • RFCs don’t change. Updates documented by new RFCs. • Not all RFCs document protocols; Some for discussion,

informational purposes, April Fools' RFCs distinguished by their date.

• There are more than 2000 RFCs in existence, dating back to ARPANET in the 1970s.

• Most RFCs are available as large text files, with graphics made out of typewriter characters.

http://www.freesoft.org/CIE/RFC/

21

Basic E-Mail Operation

• User creates message with user agent program– Text includes RFC 822 header and body of

message– List of destinations derived from header

• Messages are queued and sent to SMTP sender program running on a host

22

SMTP Mail Flow

• SMTP server transmits messages to appropriate hosts via TCP– Multiple messages to same host can be sent on one

connection– Errors handling necessary for faulty addresses and

unreachable hosts

• SMTP protocol attempts to provide error-free transmission, but does not provide end-to-end acknowledgement

• SMTP receiver accepts messages, places it in mailbox or forwards

23

Mail access protocols

• SMTP: delivery/storage to receiver’s server• Mail access protocol: retrieval from server

– POP: Post Office Protocol [RFC 1939]• authorization (agent <-->server) and download

– IMAP: Internet Mail Access Protocol [RFC 1730]• more features (more complex)• manipulation of stored msgs on server

– HTTP: gmail, Hotmail, Yahoo! Mail, etc.

useragent

sender’s mail server

useragent

SMTP SMTP accessprotocol

receiver’s mail server

24

RFC 822

• Defines format for text messages via electronic mail

• Used by SMTP as accepted mail format

• Specifies both envelope and contents

• Includes a variety of headers that can be included in the message header lines

25

Mail message format

SMTP: protocol for exchanging email msgs

RFC 822: standard for text message format:

• header lines, e.g.,– To:– From:– Subject:

different from SMTP commands!

• body– the “message”, ASCII

characters only

header

body

blankline

26

SMTP: final words

• SMTP uses persistent connections• SMTP requires message (header &

body) to be in 7-bit ASCII• SMTP server uses CRLF.CRLF to

determine end of message

27

Question

• Why we are able to send emails with attached image files?

RFC 822 was defined for sending ordinary ASCII text, but not sufficiently rich for multimedia messages, or for carrying non-ASCII text formats( for example, characters used by language other than English)

28

Limitations of SMTP and RFC822

• Cannot transmit executables or binary files without conversion into text through non-standard programs (e.g. UUENCODE)

• Cannot transmit diacritical marks• Transfers limited in size• Gateways do not always map properly between

EBCDIC and ASCII• Cannot handle non-text data in X.400 messages• Not all SMTP implementations adhere

completely to RFC821 (tabs, truncation, etc)

29

MIME (Multipurpose Internet Mail Extensions)

• Intended to resolve problems with SMTP and RFC822

• Specifies five new header fields, providing info about body of message

• Defines multiple content formats

• Defines encodings to enable conversion of any type of content into transferable form

30

MIME Header Fields

• MIME-Version: Indicates compliance with RFCs 1521 and 1522

• Content-Type: Describes data in sufficient detail for receiver to pick method for representation

• Content-Transfer-Encoding: Indicates type of transformation used to represent content

• Content-ID: Used to uniquely identify MIME entities

• Content-Description: Plain text description for use when object is not readable

31

Message format: multimedia extensions

• MIME: multimedia mail extension, RFC 2045, 2056

• additional lines in msg header declare MIME content type

From: [email protected] To: [email protected] Subject: Picture of yummy crepe. MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Type: image/jpeg

base64 encoded data ..... ......................... ......base64 encoded data

multimedia datatype, subtype,

parameter declaration

method usedto encode data

MIME version

encoded data

32

HTTP Overview

• Stateless protocol– TCP connection terminated as soon as

transaction completes

• Flexible in format handling

33

Web and HTTP

First some jargon• Web page consists of objects• Object can be HTML file, JPEG image, Java applet, audio file,…• Web page consists of base HTML-file which includes several

referenced objects• Each object is addressable by a URL• Example URL:

www.someschool.edu/someDept/pic.gif

host name path name

34

HTTP overviewHTTP: hypertext transfer

protocol• Web’s application layer

protocol

• client/server model

– client: browser that requests, receives, “displays” Web objects

– server: Web server sends objects in response to requests

• HTTP 1.0: RFC 1945

• HTTP 1.1: RFC 2068

PC runningExplorer

Server running

Apache Webserver

Mac runningNavigator

HTTP request

HTTP request

HTTP response

HTTP response

35

HTTP overview (continued)Uses TCP:• client initiates TCP

connection (creates socket) to server, port 80

• server accepts TCP connection from client

• HTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server)

• TCP connection closed

HTTP is “stateless”• server maintains no

information about past client requests

Protocols that maintain “state” are complex!

• past history (state) must be maintained

• if server/client crashes, their views of “state” may be inconsistent, must be reconciled

36

HTTP connections

Nonpersistent HTTP• At most one object is

sent over a TCP connection.

• HTTP/1.0 uses nonpersistent HTTP

Persistent HTTP• Multiple objects can

be sent over single TCP connection between client and server.

• HTTP/1.1 uses persistent connections in default mode

37

Nonpersistent HTTPSuppose user enters URL www.someSchool.edu/someDepartment/home.index

1a. HTTP client initiates TCP connection to HTTP server (process) at www.someSchool.edu on port 80

2. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object someDepartment/home.index

1b. HTTP server at host www.someSchool.edu waiting for TCP connection at port 80. “accepts” connection, notifying client

3. HTTP server receives request message, forms response message containing requested object, and sends message into its socket

time

(contains text, references to 10

jpeg images)

38

Nonpersistent HTTP (cont.)

5. HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects

6. Steps 1-5 repeated for each of 10 jpeg objects

4. HTTP server closes TCP connection.

time

39

Non-Persistent HTTP: Response time

Definition of RTT: time to send a small packet to travel from client to server and back.

Response time:• one RTT ( round-trip

time) to initiate TCP connection

• one RTT for HTTP request and first few bytes of HTTP response to return

• file transmission timetotal = 2RTT+transmit time

time to transmit file

initiate TCPconnection

RTT

requestfile

RTT

filereceived

time time

40

Persistent HTTP

Nonpersistent HTTP issues:• requires 2 RTTs per object• OS overhead for each TCP connection• browsers often open parallel TCP connections to fetch

referenced objects

Persistent HTTP• server leaves connection open after sending response

• subsequent HTTP messages between same client/server sent over open connection

41

HTTP request message

• two types of HTTP messages: request, response• HTTP request message:

– ASCII (human-readable format)

GET /somedir/page.html HTTP/1.1Host: www.someschool.edu User-agent: Mozilla/4.0Connection: close Accept-language:fr

(extra carriage return, line feed)

request line(GET, POST,

HEAD commands)

header lines

Carriage return, line feed

indicates end of message

42

Uploading form input

Post method:• Web page often

includes form input• Input is uploaded to

server in entity body

URL method:• Uses GET method• Input is uploaded in

URL field of request line:

www.somesite.com/animalsearch?monkeys&banana

43

Method types

HTTP/1.0• GET• POST• HEAD

– asks server to leave requested object out of response

HTTP/1.1• GET, POST, HEAD• PUT

– uploads file in entity body to path specified in URL field

• DELETE– deletes file specified in

the URL field

44

HTTP response message

HTTP/1.1 200 OK Connection closeDate: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Mon, 22 Jun 1998 …... Content-Length: 6821 Content-Type: text/html data data data data data ...

status line(protocol

status codestatus phrase)

header lines

data, e.g., requestedHTML file

45

HTTP response status codes

200 OK– request succeeded, requested object later in this message

301 Moved Permanently– requested object moved, new location specified later in this

message (Location:)

400 Bad Request– request message not understood by server

404 Not Found– requested document not found on this server

505 HTTP Version Not Supported

In first line in server->client response message.

A few sample codes:

46

HTTP Operation

47

HTTP Intermediate Systems

• Proxy– Forwarding agent– Security intermediary– Different versions of HTTP

• Gateway– Security intermediary– Non-HTTP server

• Tunnel– Relay point between two TCP connections

• Cache– Facility storing previous requests and responses

48

Intermediate System Examples

49

SMTP and HTTP

• HTTP: pull• SMTP: push

• both have ASCII command/response interaction, status codes

• HTTP: each object encapsulated in its own response msg

• SMTP: multiple objects sent in multipart msg

50

Session Initiation Protocol (SIP)

• Defined in RFC 3261• Manages real-time sessions over IP data network• Intended to enable Internet telephony/VoIP• Based on HTTP-like request/response transaction

model• Five facets

– User location– User availability– User capabilities– Session setup– Session management

51

SIP Components and Protocols

• Client/server elements– Client sends/receives SIP messages– Includes user agents, proxies

• Network elements– User agent (client/UAC, server/UAS)– Redirect server– Proxy server– Registrar– Location service

52

SIP Component Illustration

53

Session Description Protocol

• Media Streams

• Addresses

• Ports

• Payload types

• Start and stop times

• Originator

54

Summary

• SMTP - transmits messages to appropriate hosts via TCP, attempts to provide error-free transmission.

• MIME - Intended to resolve problems with SMTP, provides info about body of message, defines multiple content formats, and encodings

• HTTP - Stateless protocol, flexible format handling, Proxy, Gateway, Tunnel, Cache

• SIP - Manages real-time sessions over IP, enable Internet telephony/VoIP, HTTP-like request/response transaction model

55

Topic 7 – Client Server and Intranet Computing

Learning Objectives

• describe the features, characteristics and architecture of client/server applications; and

• define intranets and extranets.

56

What is Client/Server?

• Client• Server• Network• How is client/server different from other

distributed computing?– Heavy reliance on user-friendly applications– Emphasis on centralizing databases and

management functions– Commitment to openness/modularity– Networking fundamental to operation

57

Client-Server Environment

58

Why is Client-Server Different?

• Emphasis on user-friendly client applications

• Focus on access to centralized databases

• Commitment to open and modular applications

• Networking is fundamental to the organization

59

Client/Server Applications

• Emphasis on GUI for users

• Database Example– Database on server, applications for access

on client, “glue” (like SQL) enables requests)– Application logic can be client-only, or split

between client and server

60

Intranets

• Implementation of internet-based client/server technology within an organization, rather than for global connectivity

• Immensely successful in corporate computing contexts

61

Advantages of Intranets

• Rapid prototyping• Scales effectively• Little training required• Can be implemented

on variety of systems• Open architecture

allows interaction across platforms

• Supports a range of distributed servers

• Allows integration of legacy systems on client and server side

• Supports a range of media types

• Inexpensive to implement

62

The Intranet Web

• Web Content– The web can be used to effectively distribute content

in a way that requires no new training for end-users

• Web/Database Connectivity– Multiple tools exist to serve as middleware between

web servers and data sources

• Electronic Mail• Network News

63

Web/Database Connectivity

64

Web/Database Connectivity

• Advantages– Ease of administration– Deployment– Development speed– Flexible information

presentation

• Disadvantages– Limited functionality– Stateless operation

makes tracking difficult

65

Intranet Disadvantages

• Long development cycles• Difficulty in partitioning applications, and

modifying based on user feedback• Effort in distributing upgrades to clients• Difficult in scaling servers to respond to

increased load• Continuous requirement for more powerful

desktop machines

66

Other Intranet Technologies

• Electronic Mail– Closed internal mail systems (delivery

verification, etc)– Internal mailing lists

• Network news (USENET)– Can be adopted for internal intranet uses

67

The Extranet Web

• Extends the intranet concept to provide information and services to selected outside populations, such as customers and suppliers

• Enables the sharing of information between companies

• A TCP/IP enabled form of EDI

68

Advantages of Extranets

• Reduced costs

• More marketable products

• Increased productivity

• Enhanced profits

• Reduced inventories

• Faster time to market

69

Methods for Converting Intranets to Extranets

• Long-distance dial-up access• Internet access to intranet with security• Internet access to an external server that

duplicates some of a company’s intranet data• Internet access to an external server that

originates database queries to internal servers• Virtual private network

70

Summary

• Client/server - user-friendly client applications, centralized databases, open and modular applications, the network is fundamental

• Intranet - internet-based client/server technology within an organization, immensely successful

• Extranets – Extend intranet concept to outside community, e.g customers and suppliers, enables sharing of information between companies, TCP/IP enabled form of EDI.