You are on page 1of 65

SRI KRISHNA COLLEGE OF TECHNOLOGY

(AN AUTONOMOUS INSTITUTION)


KOVAIPUDUR, COIMBATORE-641042

DEPARTMENT OF CSE

COURSE CODE : 22IT402

COURSE TITLE : Networking and Communication

FACULTY NAME : Ms.A.Gomathy, AP/CSE

ACADEMIC YEAR : 2023 - 2024 (Even Semester)


Session 3.7
Module 3 - TRANSPORT LAYER AND APPLICATION LAYER

3.1 Transport Layer: UDP


TCP, Connection establishment and termination, sliding
3.2
window revisited

3.3 Flow and congestion control, timers, retransmission

3.4 Socket Programming

3.5 Application Layer: DNS

3.6 E-Mail -SMTP, MIME, POP3, IMAP

3.7 FTP, HTTP,WWW

3.8 Design issues in protocols at different layers.


Module 3 Transport Layer and Application Layer
Session 3.7

FTP
FTP uses the services of TCP.
It needs two TCP connections.
The well-known port 21 is used
for the control connection
and the well-known
port 20 for the data connection.

Module 3 Transport Layer and Application Layer


Session 3.7
FTP

Module 3 Transport Layer and Application Layer


Session 3.7
Connections: The control connection

Module 3 Transport Layer and Application Layer


Session 3.7

The Data Connection


• Uses Server’s well-known port 20
1. Client issues a passive open on an ephemeral
port, say x.
2. Client uses PORT command to tell the server
about the port number x.
3. Server issues an active open from port 20 to
port x.
4. Server creates a child server/ephemeral port
number to serve the client

Module 3 Transport Layer and Application Layer


Session 3.7

Creating
the data
connection

Module 3 Transport Layer and Application Layer


Session 3.7

Communication
Using the control connection

Module 3 Transport Layer and Application Layer


Session 3.7

NVT
FTP FTP

Module 3 Transport Layer and Application Layer


Session 3.7

Format of NVT ASCII characters

Module 3 Transport Layer and Application Layer


Session 3.7

Format of NVT control characters

Module 3 Transport Layer and Application Layer


Session 3.7

Using the data connection

Module 3 Transport Layer and Application Layer


Session 3.7
File Type

• ASCII or EBCDIC
– Nonprint
– TELNET
• Image

Module 3 Transport Layer and Application Layer


Session 3.7
Data Structure

• File Structure
• Record Structure
• Page Structure

Module 3 Transport Layer and Application Layer


Session 3.7

Transmission Mode
• Stream mode
• Block mode
• Compressed mode

Module 3 Transport Layer and Application Layer


Session 3.7

Command processing

• Access Commands
• File Management
• Data Formatting
• Port defining
• File transfer
• Miscellaneous
Module 3 Transport Layer and Application Layer
Session 3.7

File transfer

Module 3 Transport Layer and Application Layer


Session 3.7

Example 1

Module 3 Transport Layer and Application Layer


Session 3.7

Example 2

Module 3 Transport Layer and Application Layer


Session 3.7

HTTP
Hypertext Transfer Protocol

Module 3 Transport Layer and Application Layer


Session 3.7
What It Is

• Protocol for transfer of various data formats


between server and client
– Plaintext
– Hypertext
– Images
– Video
– Sound
• Meta-information also transferred
21
Module 3 Transport Layer and Application Layer
Session 3.7
Uniform Resources

• URL
– Uniform Resource Locator
– Refers to an existing protocol
• http:, wais:, ftp:, mailto:, gopher:, news:
– Points to a document on a specific server
• URN
– Uniform Resource Name
– Globally unique, persistent identifier
• Independent of location

22
Module 3 Transport Layer and Application Layer
Session 3.7
Uniform Resources

• URI
– Uniform Resource Identifier
– Collection of URL’s and URN’s

23
Module 3 Transport Layer and Application Layer
Session 3.7
URL

• <scheme> : //<host> :<port>


/<path> ;<parameters> ?<query>
#<fragment>
– scheme
• The protocol you are using
– host
• Host name or ip number
– port
• TCP port number that protocol server is using
– path
• Path and filename reference of object on server
24
Module 3 Transport Layer and Application Layer
Session 3.7
URL

• <scheme> : //<host> :<port>


/<path> ;<parameters> ?<query>
#<fragment>
– parameters
• Any specific parameters that object needs
– query
• Query string for a CGI program
– fragment
• Reference to a subset of an object

25
Module 3 Transport Layer and Application Layer
Session 3.7
URL and HTTP

• All parts of URL, except parameters, used


with http
• Scheme and host can be omitted when
referenced object is on same machine as
referring document
• Port can be omitted so long as referenced host
is running on port listed in your /etc/services
file
– Usually port 80
26
Module 3 Transport Layer and Application Layer
Session 3.7
URL and HTTP

• Full path used when referring to another


server
– Relative path on same server
• Reference with relative path is a partial URL
• Query passes parameters to CGI
• Fragment jumps to labels within a page
– http://www.x.y/z#foo

27
Module 3 Transport Layer and Application Layer
Session 3.7
Web Documents

– html
– ASCII text
– Preformatted
• postscript
– Images
• GIF
• JPEG
– Video
• MPEG
– VRML
– Java
28
Module 3 Transport Layer and Application Layer
Session 3.7
Communication

• Server tells client what type of information


is coming before information arrives
– File extensions
• .html .htm
• .txt
• .ps
• .au
• .gif .tiff .jpeg
• .mpeg
• .vrml .wrl
• .java

29
Module 3 Transport Layer and Application Layer
Session 3.7
Communication

• Text and inline images


– Separate objects
• Client browser may optionally send a list of
formats it can accept
• Document can be a program
– Web server executes program and sends results to
client
– Generic term for this program is script, gateway,
or gateway script
30
Module 3 Transport Layer and Application Layer
Session 3.7
Scripts

• Translates input from client


• Calls other programs
• Translates output from programs and returns
it to client

31
Module 3 Transport Layer and Application Layer
Session 3.7
Gateways

• Translates from one protocol or service to


another
– HTTP / database query
– Database query results / HTTP

32
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0

• Berners Lee, Fielding, Nielsen - 1995


• Used in hypermedia systems distributed
across networks
• Defines request-response conversation
– Requesting program (client) establishes
connection with receiving program (server)
– Client sends request to server
• HTTP specifies syntax

33
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0

• Defines request-response conversation


– Server replies with response
• http specifies syntax
• Does not handle network connectivity or
how information is transmitted
• TCP/IP does this

34
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0

• HTTP request
– Method
– URI
– Protocol version
– Optional other information
– Method [Request URI] HTTP/1.0 <CRLF>

35
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0

• Method
– Get
• Returns object
– Head
• Returns information about object
– Post
• Sends information to be stored on server or as input
to script

36
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0

• Method
– Put
• Sends new copy of existing object to server
• Usually not allowed
– Delete
• Deletes object
• Usually not allowed

37
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0

• Other information
– User Agent
• Kind of browser
– If-Modified-Since
• Returns object only if more recent than given date
• Otherwise returns status code 304

38
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0

• Other information
– Accept
• Mime types which browser can accept
– Multipurpose Internet Mail Extension
» text/plain
» text/html
» application/postscript
» image/gif
» image/jpeg
» audio/basic
» video/mpeg
» x-world/x-vrml
39
Module 3 Transport Layer and Application Layer
HTTP 1.0

• Other information
– Authorization
• User password
GET /X/Y/Z.HTML HTTP 1.0
User Agent: Prodigy-WB/1.3e
Accept: text/plain
Accept: text/html
Accept: application/postscript
Accept: image/gif
– Accept: */*
40
Session 3.7
HTTP 1.0

• HTTP response
– Status line
• HTTP-version Status-code Reason
• Status-codes 1xx - Informational
– Reserved for future use

41
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0

• HTTP response
– Status line
• Status-codes 2xx - Success
– The action was successfully received, understood, and
accepted
» 200 OK
» 201 POST command successful
» 202 Request accepted
» 203 GET or HEAD request
fulfilled
» 204 No content

42
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0

• HTTP response
– Status line
• Status-codes 3xx - Redirection
– Further action must be taken in order to complete request
» 300 Resource found at multiple
locations
» 301 Resource moved permanently
» 302 Resource moved temporarily
» 304 Resource has not modified (since date)

43
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0

• HTTP response
– Status line
• Status-codes 4xx - Client error
– The request contains bad syntax or cannot be fulfilled
» 400 Bad request from client
» 401 Unauthorized request
» 402 Payment required for request
» 403 Resource access forbidden
» 404 Resource not found
» 405 Method not allowed for resource
» 406 Resource type not acceptable

44
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0

• HTTP response
– Status line
• Status-codes 5xx - Server error
– The server failed to fulfill an apparently valid request
» 500 Internal server error
» 501 Method not implemented
» 502 Bad gateway or server
overload
» 503 Service unavailable / gateway
timeout
» 504 Secondary gateway / server
timeout
45
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0

• HTTP response
– Description of information
• Server Type of server
• Date Date and time
• Content-Length Number of bytes
• Content-Type Mime type
• Content-Language English, for example
• Content-Encoding Data compression
• Last-Modified Date when last modified
• Expires Date when file becomes
invalid
46
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP 1.0

• Problems
– HTTP is stateless
• Each request requires separate TCP connection
• Server doesn’t remember previous requests

47
Module 3 Transport Layer and Application Layer
Session 3.7

The World Wide Web

Outline
Background
Structure
Protocols

48
Module 3 Transport Layer and Application Layer
Session 3.7
WWW Background
• 1989-1990 – Tim Berners-Lee invents the World Wide
Web at CERN
– Means for transferring text and graphics simultaneously
– Client/Server data transfer protocol
• Communication via application level protocol
• System ran on top of standard networking infrastructure
– Text mark up language
• Not invented by Bernes-Lee
• Simple and easy to use
• Requires a client application to render text/graphics
49
Module 3 Transport Layer and Application Layer
Session 3.7
WWW History contd.
• 1994 – Mark Andreesen invents MOSAIC at National Center for
Super Computing Applications (NCSA)
– First graphical browser
– Internet’s first “killer app”
– Freely distributed
– Became Netscape Inc.
• 1995 (approx.) – Web traffic becomes dominant
– Exponential growth
– E-commerce
– Web infrastructure companies
– World Wide Web Consortium
• Reference: “Web Protocols and Practice”, Krishnamurthy and
Rexford
50
Module 3 Transport Layer and Application Layer
Session 3.7

WWW Components
• Structural Components
– Clients/browsers – to dominant implementations
– Servers – run on sophisticated hardware
– Caches – many interesting implementations
– Internet – the global infrastructure which facilitates data transfer
• Semantic Components
– Hyper Text Transfer Protocol (HTTP)
– Hyper Text Markup Language (HTML)
• eXtensible Markup Language (XML)
– Uniform Resource Identifiers (URIs)

51
Module 3 Transport Layer and Application Layer
Session 3.7
Quick Aside – Web server use

Source: Netcraft Server Survey, 2001

52
Module 3 Transport Layer and Application Layer
Session 3.7

WWW Structure
• Clients use browser application to send URIs via HTTP to servers
requesting a Web page
• Web pages constructed using HTML (or other markup language)
and consist of text, graphics, sounds plus embedded files
• Servers (or caches) respond with requested Web page
– Or with error message
• Client’s browser renders Web page returned by server
– Page is written using Hyper Text Markup Language (HTML)
– Displaying text, graphics and sound in browser
– Writing data as well
• The entire system runs over standard networking protocols
(TCP/IP, DNS,…)

53
Module 3 Transport Layer and Application Layer
Session 3.7

Uniform Resource Identifiers


• Web resources need names/identifiers – Uniform Resource
Identifiers (URIs)
– Resource can reside anywhere on the Internet
• URIs are a somewhat abstract notion
– A pointer to a resource to which request methods can be applied to
generate potentially different responses
• A request method is eg. fetching or changing the object
• Instance: http://www.foo.com/index.html
– Protocol, server, resource
• Most popular form of a URI is the Uniform Resource Locator
(URL)
– Differences between URI and URL are beyond scope
– RFC 2396

54
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP Basics
• Protocol for client/server communication
– The heart of the Web
– Very simple request/response protocol
• Client sends request message, server replies with response message
– Stateless
– Relies on URI naming mechanism
• Three versions have been used
– 09/1.0 – very close to Berners-Lee’s original
• RFC 1945 (original RFC is now expired)
– 1.1 – developed to enhance performance, caching, compression
• RFC 2068
– 1.0 dominates today but 1.1 is catching up

55
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP Request Messages
• GET – retrieve document specified by URL
• PUT – store specified document under given URL
• HEAD – retrieve info. about document specified by URL
• OPTIONS – retrieve information about available options
• POST – give information (eg. annotation) to the server
• DELETE – remove document specified by URL
• TRACE – loopback request message
• CONNECT – for use by caches

56
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP Request Format

request-line ( request request-URI HTTP-version)


headers (0 or more)
<blank line>
body (only for POST request)

• First type of HTTP message: requests


– Client browsers construct and send message
• Typical HTTP request:
– GET http://www.cs.wisc.edu/index.html HTTP/1.0

57
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP Response Format

status-line (HTTP-version response-code response-phrase)


headers (0 or more)
<blank line>
body

• Second type of HTTP message: response


– Web servers construct and send response messages
• Typical HTTP response:
– HTTP/1.0 301 Moved Permanently
Location: http://www.wisc.edu/cs/index.html
58
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP Response Codes

• 1xx – Informational – request received,


processing
• 2xx – Success – action received, understood,
accepted
• 3xx – Redirection – further action necessary
• 4xx – Client Error – bad syntax or cannot be
fulfilled
• 5xx – Server Error – server failed
59
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP Headers
• Both requests and responses can contain a variable
number of header fields
– Consists of field name, colon, space, field value
– 17 possible header types divided into three categories
• Request
• Response
• Body
• Example: Date: Friday, 27-Apr-01 13:30:01 GMT
• Example: Content-length: 3001

60
Module 3 Transport Layer and Application Layer
Session 3.7
HTTP/1.0 Network Interaction
• Clients make requests to port 80 on servers
– Uses DNS to resolve server name
• Clients make separate TCP connection for each URL
– Some browsers open multiple TCP connections
• Netscape default = 4
• Server returns HTML page
– Many types of servers with a variety of implementations
– Apache is the most widely used
• Freely available in source form
• Client parses page
– Requests embedded objects

61
Module 3 Transport Layer and Application Layer
Session 3.7

HTTP/1.1 Performance Enhancements


• HTTP/1.0 is a “stop and wait” protocol
– Separate TCP connection for each file
• Connect setup and tear down is incurred for each file
• Inefficient use of packets
• Server must maintain many connections in TIME_WAIT
• Mogul and Padmanabahn studied these issues in ’95
– Resulted in HTTP/1.1 specification focused on performance
enhancements
• Persistent connections
• Pipelining
• Enhanced caching options
• Support for compression

62
Session 3.7

Persistent Connections and


• Persistent connections
– Use the same TCPPipelining
connection(s) for transfer of multiple files
– Reduces packet traffic significantly
– May or may not increase performance from client perspective
• Load on server increases
• Pipelining
– Pack as much data into a packet as possible
– Requires length field(s) within header
– May or may not reduce packet traffic or increase
performance

63
Session 3.7
HTML Basics
• Hyper-Text Markup Language
– A subset of Standardized General Markup Language (SGML)
– Facilitates a hyper-media environment
• Embedded links to other documents and applications
• Documents use elements to “mark up” or identify sections of text
for different purposes or display characteristics
• Mark up elements are not seen by the user when page is displayed
• Documents are rendered by browsers
• NOTE: Not all documents in the Web are HTML!
• Most people use WYSIWYG editors (MS Word) to generate
HTML

64
Module 3 Transport Layer and Application Layer
Session 3.7
HTML Example

<HTML>
<HEAD>
<TITLE> PB’s HomePage </TITLE>
</HEAD>
<BODY>
<CENTER><IMG SRC = “bad_picture.gif” ALT = “ “><BR></CENTER>
<P><CENTER><H1>UW Computer Science Department</H1></CENTER>
Welcome to my goofy HomePage!

<A HREF = http://www.cs.wisc.edu/~pb/mydogs_page.html> Spot’s Page </A>
</BODY>
</HTML>

65
Module 3 Transport Layer and Application Layer

You might also like