[go: up one dir, main page]

0% found this document useful (0 votes)
8 views191 pages

Module 5

The document outlines the Transport Layer of networking, detailing its purpose to provide reliable and efficient communication services to application processes. It covers key concepts such as transport service primitives, socket programming, connection establishment and release, error control, and flow control, along with examples of socket programming for both server and client. Additionally, it discusses the differences between connection-oriented (TCP) and connectionless (UDP) protocols, highlighting their respective functionalities and use cases.

Uploaded by

eng22cs0424
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views191 pages

Module 5

The document outlines the Transport Layer of networking, detailing its purpose to provide reliable and efficient communication services to application processes. It covers key concepts such as transport service primitives, socket programming, connection establishment and release, error control, and flow control, along with examples of socket programming for both server and client. Additionally, it discusses the differences between connection-oriented (TCP) and connectionless (UDP) protocols, highlighting their respective functionalities and use cases.

Uploaded by

eng22cs0424
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 191

Transport Layer

Syllabus
The Transport Service
Services Provided to the Upper Layers
Transport Service Primitives
Berkeley Sockets
An Example of Socket Programming: An Internet File Server
Elements of Transport Protocols
Addressing
Connection Establishment
Connection Release
Error Control and Flow Control
Multiplexing
Crash Recovery
Transport Layer
The ultimate goal of the transport layer is to provide efficient, reliable, and
cost-effective service to its users, normally processes in the application layer. To
achieve this goal, the transport layer makes use of the services provided by the
network layer. The hardware and/or software within the transport layer that
does the work is called the transport entity.
Position of transport layer
Transport Layer

Process-to-process delivery

© Dr. Ayman Abdel-Hamid, CS4254 Spring


TCP 4
2006
Services Provided to the Upper Layers
❖The bottom four layers can be seen as the transport service provider, whereas
the upper layer(s) are the transport service user.

❖To allow users to access the transport service, the transport layer must provide
some operations to application programs, that is, a transport service interface.
Each transport service has its own interface.

❖The transport service is similar to the network service, but there are also some
important differences. The main difference is that the network service is
intended to model the service offered by real networks, warts and all. Real
networks can lose packets, so the network service is generally unreliable. The
(connection-oriented) transport service, in contrast, is reliable.

❖A second difference between the network service and transport service is whom
the services are intended for. The network service is used only by the transport
entities. Few users write their own transport entities, and thus few users or
programs ever see the bare network service. In contrast, many programs see the
transport primitives. Consequently, the transport service must be convenient
and easy to use.
Transport Service Primitives

The primitives for a simple transport service.

The nesting of TPDUs, packets, and frames.


• A machine provides a variety of services and to differentiate
between these services, each service is assigned with a
unique port number.
• The port numbers less than 1024 are considered as
well-known ports and are reserved for standard services.
• In transport layer, two processes communicate with each
other via sockets. A socket acts as an end point of the
communication path between the processes.

• The IP address and Port address put together defines the


socket address.
Berkeley Sockets
Socket primitives abstract transport services, making them accessible and
flexible for application programming. Originally released in 1983 as part of
Berkeley UNIX 4.2BSD, sockets became the standard for network
programming, particularly with TCP.
• Server-Side Socket Workflow:
• SOCKET:
o Creates a new endpoint and allocates resources in the transport entity.
o Parameters specify:
▪ Addressing format (e.g., IPv4/IPv6).
▪ Type of service (e.g., reliable byte stream).
▪ Protocol (e.g., TCP).
o Returns a file descriptor for subsequent calls.
• BIND:
o Assigns a network address to the socket.
o Allows specific address selection, useful for well-known services (e.g.,
HTTP servers).
• LISTEN:
o Prepares the socket to accept incoming connections.
o Allocates a queue for multiple incoming requests.
• ACCEPT:
o Blocks until a connection request arrives.
o Creates a new socket for the connection, leaving the original socket
available for other requests.
o Returns a file descriptor for data transfer.
A state diagram for a simple connection management scheme. Transitions
labeled in italics are caused by packet arrivals. The solid lines show the
client’s state sequence. The dashed lines show the server’s state sequence
Berkeley Sockets
Client-Side Socket Workflow:
• SOCKET:
o Creates a new socket.
o Unlike the server, BIND is not typically required since
the client address is determined automatically.
• CONNECT:
o Blocks the client process and initiates the connection.
o The connection is established once the server
acknowledges.
• SEND/RECEIVE:
o Used for full-duplex communication.
o Alternatively, UNIX's standard READ/WRITE system calls
may be used if no special options are required.
• CLOSE:
o Both sides must execute this to release the connection
resources.
o Connection release is symmetric
Berkeley Sockets
Socket API Versatility:
∙ Connection-Oriented Services:
o Typically paired with TCP to provide a reliable byte stream, abstracting the complexities of underlying
protocols.
∙ Connectionless Services:
o For datagram protocols like UDP:
▪ CONNECT associates the socket with a remote peer.
▪ SEND and RECEIVE transmit and receive datagrams.
∙ Other Protocols:
o Supports alternatives like DCCP (Datagram Congestion Control Protocol), providing message-based
services with congestion control.
Berkeley Sockets
Challenges and Extensions:
• Grouped Streams:
o Applications like web browsers often use multiple streams for related
objects, which sockets handle separately, leading to inefficiencies
(e.g., independent congestion control per stream).
• Improved Protocols:
o SCTP (Stream Control Transmission Protocol):
▪ Supports grouped streams for better resource management and

congestion control.
o QUIC:
▪ Provides enhanced performance and security, especially for

HTTP/3, using multiple paths and traffic modes.


• Future Developments:
o APIs may evolve to better support grouped streams, hybrid traffic
types (connection-oriented and connectionless), and more efficient
transport.
• The socket API remains a robust and versatile interface for network
communication, but advancements like SCTP and QUIC point
toward evolving needs in modern applications.
An Example of Socket Programming: An Internet File Server

Server Code Overview


1. Setup and Initialization:
o Includes standard headers for network programming.
o Defines constants for SERVER_PORT (8080), CHUNK_SIZE (file transfer block size), and
QUEUE_SIZE (maximum pending connections).
o Initializes the server’s IP address structure using memset and sets relevant fields like port and IP
address using htons and htonl.
2. Socket Creation and Configuration:
o socket(): Creates a socket for communication.
o setsockopt(): Ensures the port can be reused, preventing errors when restarting the server.
o bind(): Associates the socket with the server's IP address and port.
o listen(): Enables the server to accept incoming connections, specifying a queue size.
3. Main Loop:
o accept(): Blocks until a client attempts to connect, returning a new socket descriptor (sa) for
communication.
o Reads the requested filename from the client, opens the file, and streams it block-by-block to the
client using read() and write().
o Closes the connection and waits for the next client.
Client Code Overview
1. Invocation:
Run as:
bash
Copy code
client <server_name> <file_path> > <output_file>
E.g.,
bash
Copy code
client flits.cs.vu.nl /usr/tom/filename > output.txt
The server must be running and have access to the requested file.
1. Setup and Initialization:
o Validates input arguments.
o Uses gethostbyname() to resolve the server's domain name (e.g., flits.cs.vu.nl) to its IP address.
2. Socket Operations:
o socket(): Creates a socket for communication.
o connect(): Establishes a TCP connection to the server.
3. File Request and Transfer:
o Sends the filename to the server, including a null terminator to indicate the end of the filename.
o Reads file data from the socket in blocks and writes it to the standard output.
4. Error Handling:
o The fatal() function prints error messages and exits, though it is simplified here.
• Key Concepts Demonstrated
1. Client-Server Architecture:
o The server handles incoming connections and processes requests
sequentially.
o The client initiates connections and sends specific requests.
2. Socket API:
o Illustrates common primitives: socket, bind, listen, accept, connect, send,
and receive.
3. TCP Communication:
o Ensures reliable and ordered data delivery using a bidirectional
communication channel.
4. Blocking Operations:
o Server blocks on accept and read, waiting for client connections and data.
o Client blocks on connect and read for server responses.
• Limitations of the Example
1. Sequential Processing:
o The server processes one request at a time, reducing throughput and
scalability.
2. Error Handling:
o Minimal error checking and simplistic error reporting.
3. Security:
o No authentication or access control is implemented, making it insecure for
real-world use.
4. Assumptions:
o Assumes the filename fits in the buffer and that it is transmitted atomically,
which may not hold in practical scenarios.
5. Platform Independence:
o Relies on UNIX system calls, limiting its portability.
Elements of Transport Protocols
The transport service is implemented by a transport protocol used between the
two transport entities.

Though the transport protocols resemble the Data Link Protocols, significant
differences are present due to the major dissimilarities between the
environments in which the two protocols operate.

A physical channel exists in DLL, where as it is replaced by the entire subnet for
Transport Layer

No explicit addressing of destinations is required in DLL, where it is required for


Transport layer

A final difference between the data link and transport layers is one of amount
rather than of kind. Buffering and flow control are needed in both layers, but
the presence of a large and dynamically varying number of connections in the
transport layer may require a different approach than we used in the data link
layer
Addressing
• When an application process wishes to set up a connection to a remote
application process, it must specify which one to connect to. The method
normally used is to define transport addresses to which processes can
listen for connection requests. In the Internet, these end points are called
ports.

Application processes, both clients


and servers, can attach themselves
to a TSAP to establish a connection
to a remote TSAP. These connections
run through NSAPs on each host
initial connection protocol

Instead of every conceivable server listening at a well-known TSAP, each machine


that wishes to offer services to remote users has a special process server that
acts as a proxy for less heavily used servers. It listens to a set of ports at the same
time, waiting for a connection request.
This server is called inetd on UNIX systems…….
Connection Establishment
The problem with a simple communication request & communication
accepted exchange is that the network can lose, store, and duplicate
packets. This behavior causes serious complications.

The Crux of the problem is the existence of delayed duplicates. Various


ways to attack the problem are:

Using a throw-away transport address


Give each connection a connection identifier
A mechanism to kill off aged packets
Restricted subnet design
Hop Counter
Time Stamping
Connection Establishment (3)

Three protocol scenarios for establishing a connection using a


three-way handshake. CR denotes CONNECTION REQUEST.
(a) Normal operation,
(b) Old CONNECTION REQUEST appearing out of nowhere.
(c) Duplicate CONNECTION REQUEST and duplicate ACK.
Connection Release

Abrupt disconnection with loss of data.


Connection Release
Four protocol scenarios for releasing a
connection. (a) Normal case of a three-way
handshake. (b) final ACK lost.

6-14, a, b

Four protocol scenarios for releasing a connection.


(a) Normal case of a three-way handshake. (b) final ACK lost.
Connection Release

6-14, c,d

(c) Response lost. (d) Response lost and subsequent DRs lost.
Flow Control and Buffering

(a) Chained fixed-size buffers. (b) Chained variable-sized buffers.


(c) One large circular buffer per connection.
• The optimum trade-off between source buffering and
destination buffering depends on the type of traffic carried by
the connection. For low-bandwidth bursty traffic, such as that
produced by an interactive terminal the sender must retain a
copy of the TPDU until it is acknowledged.

• On the other hand, for file transfer and other high-bandwidth


traffic, it is better if the receiver does dedicate a full window of
buffers, to allow the data to flow at maximum speed.

• Thus, for low-bandwidth bursty traffic, it is better to buffer at


the sender, and for high bandwidth smooth traffic, it is better
to buffer at the receiver.
Multiplexing

If only one network address is available on a host, all transport connections on


that machine have to use it. When a TPDU comes in, some way is needed to tell
which process to give it to. This situation is called upward multiplexing.

Multiplexing can also be useful in the transport layer for another reason.
Suppose, for example, that a subnet uses virtual circuits internally and imposes a
maximum data rate on each one. If a user needs more bandwidth than one virtual
circuit can provide, a way out is to open multiple network connections and
distribute the traffic among them on a round-robin basis, called downward
multiplexing.
UDP
• The User Datagram Protocol (UDP) is a transport layer
protocol defined for use with the IP network layer
protocol. It is defined by RFC 768 written by John Postel.
It provides a best-effort datagram service to an End
System (IP host).
• The service provided by UDP is an unreliable service that
provides no guarantees for delivery and no protection
from duplication. The simplicity of UDP reduces the
overhead from using the protocol and the services may
be adequate in many cases.
• UDP provides a minimal, unreliable, best-effort,
message-passing transport to applications and
upper-layer protocols
Introduction to UDP
The Internet protocol suite supports a connectionless transport protocol, UDP (User
Datagram Protocol).
The UDP header.

UDP provides a way for applications to send encapsulated IP datagrams and


send them without having to establish a connection. UDP is described in RFC
768.

UDP transmits segments consisting of an 8-byte header followed by the


payload. The two ports serve to identify the end points within the source and
destination machines. When a UDP packet arrives, its payload is handed to
the process attached to the destination port.

The source port is primarily needed when a reply must be sent back to the
source. The UDP length field includes the 8-byte header and the data.
UDP Checksum (A checksum to verify that the end to end data has not been
corrupted by routers or bridges in the network or by the processing in an end
system. The algorithm to compute the checksum is the Standard Internet
Checksum algorithm. This allows the receiver to verify that it was the intended
destination of the packet, because it covers the IP addresses, port numbers and
protocol number, and it verifies that the packet is not truncated or padded,
because it covers the size field. Therefore, this protects an application against
receiving corrupted payload data in place of, or in addition to, the data that was
sent. In the cases where this check is not required, the value of 0x0000 is placed
in this field, in which case the data is not checked by the receiver.
The Internet Transport Protocols: TCP
• TCP (Transmission Control Protocol) was specifically designed
to provide a reliable end-to-end byte stream over an
unreliable internetwork.

• TCP was formally defined in RFC 793.

• The IP layer gives no guarantee that datagrams will be


delivered properly, so it is up to TCP to time out and
retransmit them as need be. Datagrams that do arrive may
well do so in the wrong order; it is also up to TCP to
reassemble them into messages in the proper sequence. In
short, TCP must furnish the reliability that most users want
and that IP does not provide.
The TCP Service Model
• TCP service is obtained by both the sender and receiver creating end points,
called sockets. Each socket has a socket number (address) consisting of the IP
address of the host and a 16-bit number local to that host, called a port.

A socket may be used for multiple connections at the same time. In other
words, two or more connections may terminate at the same socket.
Connections are identified by the socket identifiers at both ends, that is,
(socket1, socket2). No virtual circuit numbers or other identifiers are used.
Port numbers below 1024 are called well-known ports and are reserved for
standard services
TCP Protocol
applicatio applicatio
n rites
w n
reads
socke socke
data data
t laye t laye
r TCP data segment TCP r
send receive
buffer ACK segment buffer

• Provides a reliable, in-order, byte stream abstraction:


– Recover lost packets and detect/drop duplicates
– Detect and drop corrupted packets
– Preserve order in byte stream, no “message boundaries”
– Full-duplex: bi-directional data flow in same connection
• Flow and congestion control:
– Flow control: sender will not overwhelm receiver
– Congestion control: sender will not overwhelm the network
– Sliding window flow control
– Send and receive buffers
– Congestion control done via adaptive flow control window size

33
The TCP Service Model
• All TCP connections are full duplex and point-to-point. Full duplex
means that traffic can go in both directions at the same time.
Point-to-point means that each connection has exactly two end
points. TCP does not support multicasting or broadcasting.

• A TCP connection is a byte stream, not a message stream.


Message boundaries are not preserved end to end.

(a) Four 512-byte segments sent as separate IP datagrams.


(b) The 2048 bytes of data delivered to the application in a single READ CALL.
The TCP Protocol
• Every byte on a TCP connection has its own 32-bit sequence
number.

• The sending and receiving TCP entities exchange data in the


form of segments. A TCP segment consists of a fixed 20-byte
header (plus an optional part) followed by zero or more data
bytes. The TCP software decides how big segments should be.

• Two limits restrict the segment size. First, each segment,


including the TCP header, must fit in the 65,515-byte IP
payload. Second, each network has a maximum transfer unit,
or MTU, and each segment must fit in the MTU
TCP segment format
The TCP Segment Header

TCP Header.
• The Source port and Destination port fields identify the local end
points of the connection. A port plus its host's IP address forms a
48-bit unique end point. The source and destination end points
together identify the connection.
• This connection identifier is called a 5 tuple because it consists
of five pieces of information: the protocol (TCP), source, IP and
source port, and destination IP and destination port.
• The Sequence number and Acknowledgement number fields
perform their usual functions. The latter specifies the next byte
expected, not the last byte correctly received. Both are 32 bits
long because every byte of data is numbered in a TCP stream.
• The TCP header length tells how many 32-bit words are
contained in the TCP header.
• Next comes a 4-bit field that is not used.
• CWR and ECE are used to signal congestion when ECN (Explicit
Congestion Notification) is used. ECE is set to signal an
ECN-Echo to a TCP sender to tell it to slow down when the TCP
receiver gets a congestion indication from the network. CWR
is set to signal Congestion Window Reduced from the TCP
sender to the TCP receiver so that it knows the sender has
slowed down and can stop sending the ECN-Echo.

• URG is set to 1 if the Urgent pointer is in use. The Urgent


pointer is used to indicate a byte offset from the current
sequence number at which urgent data are to be found.

• The ACK bit is set to 1 to indicate that the Acknowledgement


number is valid.
• The PSH bit indicates PUSHed data. The receiver is hereby
kindly requested to deliver the data to the application upon
arrival and not buffer it until a full buffer has been received.

• The RST bit is used to abruptly reset a connection that has


become confused due to a host crash or some other reason.

• The SYN bit is used to establish connections. The connection


request has SYN = 1 and ACK = 0. The connection reply does
bear an acknowledgement, however, so it has SYN = 1 and
ACK = 1.

• The FIN bit is used to release a connection. It specifies that the


sender has no more data to transmit.
• Flow control in TCP is handled using a variable-sized sliding
window. The Window size field tells how many bytes may be
sent starting at the byte acknowledged.
• A Checksum is also provided for extra reliability. It checksums
the header, the data, and a conceptual pseudoheader in exactly
the same way as UDP.
• The Options field provides a way to add extra facilities not
covered by the regular header. Many options have been
defined and several are commonly used.
– A widely used option is the one that allows each host to specify the MSS
(Maximum Segment Size) it is willing to accept.
– The timestamp option carries a timestamp sent by the sender and
echoed by the receiver.
– The SACK (Selective ACKnowledgement) option lets a receiver tell a
sender the ranges of sequence numbers that it has received
The TCP Segment Header
The pseudoheader included in the TCP
checksum.
TCP Connection Establishment
• Connections are established in TCP by means of the three-way
handshake. To establish a connection, one side, say, the server,
passively waits for an incoming connection by executing the
LISTEN and ACCEPT primitives.
• The other side, say, the client, executes a CONNECT primitive,
specifying the IP address and port to which it wants to connect,
the maximum TCP segment size it is willing to accept, and
optionally some user data (e.g., a password). The CONNECT
primitive sends a TCP segment with the SYN bit on and ACK bit
off and waits for a response.
• When this segment arrives at the destination, the TCP entity
there checks to see if there is a process that has done a LISTEN
on the port given in the Destination port field. If not, it sends a
reply with the RST bit on to reject the connection.
(a) TCP connection establishment in the normal case. (b) Call collision
TCP Connection Management Modeling

TCP connection
management finite state
machine. The heavy solid
line is the normal path for a
client. The heavy dashed
line is the normal path for a
server. The light lines are
unusual events. Each
transition is labeled by the
event causing it and the
action resulting from it,
separated by a slash.
TCP Transmission Policy
Window probe is a packet sent by
the sender, who can send a 1-byte
segment to force the receiver to
reannounce the next byte expected
and the window size.

Delayed acknowledgements is an
optimization, where the idea is to
delay acknowledgements
and window updates for up to 500
msec in the hope of acquiring some
data on which to hitch a free ride.

Window management in TCP.


TCP Transmission Policy
Nagle’s algorithm is a way to reduce the
bandwidth wastage by a sender that
sends multiple short packets (e.g., 41-byte
packets containing 1 byte of data).

when data come into the sender in small


pieces, just send the first piece and buffer
all the rest until the first piece is
acknowledged. Then send all the buffered
data in one TCP segment and start
buffering again until the next segment is
acknowledged.

Silly window syndrome is a problem that


occurs when data are passed to the
sending TCP entity in large blocks, but an
interactive application on the receiving
side reads data only 1 byte at a time.
• Clark’s solution is to prevent the receiver from sending
a window update for 1 byte. Instead, it is forced to
wait until it has a decent amount of space available
and advertise that instead.

• Nagle’s algorithm and Clark’s solution to the silly


window syndrome are complementary. Nagle was
trying to solve the problem caused by the sending
application delivering data to TCP a byte at a time.
Clark was trying to solve the problem of the receiving
application sucking the data up from TCP a byte at a
time.

• Both solutions are valid and can work together. The


goal is for the sender not to send small segments and
the receiver not to ask for them.
TCP Congestion Control

(a) A fast network feeding a low capacity receiver.


(b) A slow network feeding a high-capacity receiver.
TCP Congestion Control
• To deal with the two problems of receivers capacity and network
capacity, each sender maintains two windows: the window the receiver
has granted and a second window, the congestion window.
• Each reflects the number of bytes the sender may transmit. The
number of bytes that may be sent is the minimum of the two windows.
• When a connection is established, the sender initializes the congestion
window to the size of the maximum segment in use on the connection.
It then sends one maximum segment. Each burst acknowledged
doubles the congestion window.
• The congestion window keeps growing exponentially until either a
timeout occurs or the receiver's window is reached. This algorithm is
called slow start.
• Internet congestion control algorithm uses a third parameter, the
threshold, initially 64 KB, in addition to the receiver and congestion
windows. When a timeout occurs, the threshold is set to half of the
current congestion window, and the congestion window is reset to one
maximum segment.
TCP Congestion Control

An example of the Internet congestion algorithm.


TCP Timer Management
• Retransmission timer: When a segment is sent, a retransmission
timer is started. If the segment is acknowledged before the timer
expires, the timer is stopped. If, on the other hand, the timer
goes off before the acknowledgement comes in, the segment is
retransmitted (and the timer started again).

• Persistence timer is designed to prevent a deadlock situation


where, the sender keeps waiting for a window update from the
receiver, which is lost. When the persistence timer goes off, the
sender transmits a probe to the receiver. The response to the
probe gives the window size.

• Keepalive timer: When a connection has been idle for a long


time, the keepalive timer may go off to cause one side to check
whether the other side is still there. If it fails to respond, the
connection is terminated.
Wireless TCP and UDP
Splitting a TCP connection into two connections.

The advantage of this scheme called indirect TCP, is that both connections are now
homogeneous. Timeouts on the first connection can slow the sender down, whereas
timeouts on the second one can speed it up

Crash Recovery
The recovery from host crashes, particularly when long-lived connections are involved,
presents significant challenges in network protocols. In the transport layer, protocols like
TCP and UDP handle network and router crashes via retransmissions.
• However, recovering from host crashes is more complex, especially for scenarios where
connections may be long-lived, such as during large file transfers.
• Problem with Host Crashes
• When a server crashes during data transmission, the server's state (such as segment
acknowledgment information) is lost.
• If the server recovers and requests clients to inform it of the status of open connections, the
client may face difficulties in deciding whether to retransmit a segment. This difficulty arises
from the fact that events like sending acknowledgments and writing data to the application
cannot happen simultaneously. Thus, when a crash happens after one event but before the
other, the client may incorrectly assume the segment was received (or might retransmit
unnecessarily), leading to missing or duplicate segments.
• For example, consider a simple stop-and-wait protocol where a client sends a file to a server.
If the server crashes after sending an acknowledgment but before writing to the application,
the client will think the segment was received and be in state S0 (no segments outstanding),
leading it to skip retransmitting the segment. If the crash occurs after the write but before the
acknowledgment is sent, the client will retransmit the segment, which could lead to a
duplicate.
Crash Recovery
• Server and Client Strategies
• There are several possible strategies for how clients and servers handle the crash
recovery:
∙ Server Strategies: The server can be programmed to either acknowledge first or
write to the application first.
∙ Client Strategies: The client can either always retransmit, never retransmit, or
conditionally retransmit based on the state (S0 or S1).
• However, these strategies often lead to failures in recovery. The client may incorrectly
decide whether to retransmit based on incomplete or erroneous information, leading
to lost or duplicate segments.
• Event Sequences and Failures
• The event sequences at the server, such as acknowledging (A), writing (W), and
crashing (C), can occur in several orders, and these sequences lead to different
recovery behaviours. Some event sequences cause the protocol to fail in specific
client-server combinations. For instance, if the server crashes after sending an
acknowledgment but before the write, and the client is programmed to always
retransmit, the client will incorrectly send a duplicate segment.
Application layer
1. Introduction
DNS — The Domain Name System
Electronic Mail
WWW
Streaming Audio and Video
1) The application layer is the highest layer in the protocol suite.
2) The application layer provides services to the user.
3) The protocols in this layer do not provide services to any other
protocol in the suite; they only receive services from the protocols
in the transport layer.
4) Two application layers assume that there is an imaginary direct
connection through which they can send and receive messages.
5) The application layer is the only layer that provides services to the
Internet user
6) The flexibility of the application layer allows new application
protocols to be easily added to the Internet.
7) Applications need their own protocols.
8) These applications are part of network protocol.
Application protocols

Standard
protocols Non-standard
protocols
(eg,. SMTP, HTTP)
Standard Application-Layer Protocols
1. There are several application-layer protocols that have been
standardized and documented by the Internet authority.
2. Each standard protocol is a pair of computer programs that interact
with the user and the transport layer to provide a specific service to
the user.
3. Two very widely-used standardized application protocols:
4. SMTP : Simple Mail Transfer Protocol is used to exchange
electronic mail.
5. HTTP : Hyper Text Transport Protocol is used to communicate
between Web browsers and Web servers.
Nonstandard Application-Layer Protocols
1. A programmer can create a nonstandard application-layer program
if they can write two programs that provide service to the user by
interacting with the transport layer.
Client-Server Paradigm

In this paradigm, the service provider is


an application program, called the server
process; it runs continuously, waiting for
another application program, called the
client process, to make a connection
through the Internet and ask for service.
Client-Server Paradigm
1. The traditional paradigm is called the client-server paradigm.
2. It was the most popular Paradigm.
3. The server process must be running all the time; the client process
is started when the client needs to receive service.
4. There are normally some server processes that can provide a
specific type of service, but there are many clients that request
service from any of these server processes.
Peer-to-Peer(P2P) Paradigm
1. A new paradigm, called the peer-to-peer paradigm has emerged to
respond to the needs of some new applications.
2. In this paradigm, there is no need for a server process to be running all
the time and waiting for the client processes to connect.
3. The responsibility is shared between peers.
4. A computer connected to the Internet can provide service at one time
and receive service at another time.
5. A computer can even provide and receive services at the same time.
Mixed Paradigm
1. An application may choose to use a mixture of the two paradigms
by combining the advantages of both.
2. For example, a light-load client-server communication can be used
to find the address of the peer that can offer a service.
3. When the address of the peer is found, the actual service can be
received from the peer by using the peer-to-peer paradigm.
DNS(Domain name
system)
Introduction
• The internet model that follow the client/server paradigm.
• The DNS is a supporting program that is used by other
programs such as E-mail.
• A user of a e-mail program may know the e-mail address of
the recipient; however, the IP protocol needs the IP address.
• The DNS client program sends a request to a DNS server to
map the e-mail address to the corresponding IP address.
• To identify the remote system/user, TCP/IP protocols use the
IP address, which uniquely identifies the connection of a host
to the internet.
• However, people prefer to use names instead of numeric
values.
• The DNS system that can map a name to an address (or)
address to a name.
DNS service
• When the internet was small, mapping was done by using a
host file.[two columns-names and address-host store
it-update periodic]
• Today it is impossible, bcoz the host file would be too large
and updating problem.
• The solution is to maintain in one computer and allow
centralized access[huge traffic]
• Huge information divided into small parts today and stored
different computer.[host can contact the closest computer
holding the needed information.[method used by DNS]
Name space
• It is unambiguous, the name assigned to machines must be
unique.
• Name space map each address to a unique name in two ways.
• Flat Name space
• Hierarchical Name Space.

Flat Name Space:


✔ A name in this space is a sequence of characters without
structure.
✔ A name may (or) may not have a common section.[it has no
meaning].
✔ It cannot be used in internet.[duplication].
Flat Name space
Hierarchical Name Space
• Each name has several parts.
• The first part define the nature of the organization.
• The second part can define name of an organization.
• The third part can define departments in the organization,
and so on.
• The central authority assigned only the first two part the
name space the rest of parts are assigned organization itself.
• The organization can add prefix(or) suffix to the name to
define its host or resource.
• The organization need not worry about the same name
chosen by the other management for their resource.
Domain Name Space
• When we have hierarchical name space, a domain name
space to be designed.
• In that tree names are defined in an inverted-tree with one
root at the top.
• The tree can have only 128 levels.
• Level 0(root) to level127
Label
• Each node in the tree has a label, which is a string with a
maximum of 63 characters.
• The root label is a null string(empty).
Domain Name
• A full domain name is a sequence of labels separated by dots.
• The domain names are always read from the node up to the
root.
• Finally, it end with null(root node)
Example:
http://en.wikipedia.org/wiki/DNS_root
http://www.icann.org/en/contact
https://www.facebook.com/appcenter/ipl_top_scorer?fb_source=sea
rch&fbsid=1101
Fully Qualified Domain Name
• A fully qualified domain name (FQDN) is the complete
domain name for a specific computer, or host, on the
Internet.
• The FQDN consists of two parts: the hostname and the
domain name.
• If the label is terminated by a null string(.), it is called a
FQDN
• For example, an FQDN for a hypothetical mail server might
be mymail.somecollege.edu.
• The hostname is mymail, and the host is located within the
domain somecollege.edu.
Partially Qualified Domain Name(PQDN)
• If a label is not terminated by a NULL string, it is called a
PQDN.
• It starts from a node, but it does not reach the root.
• Here the resolver can supply the missing part, called the
suffix, to create an FQDN.
• Example:

• Google
• Yahoo
• Annauniv
• Kct
Domain
• A domain is a subtree of the domain name space.
• The name of the domain is the domain name of the node at
the top of the subtree.
Distribution of Name Servers
• The information contained in the domain name space must
be stored.
• It is inefficient also unreliable[one computer store huge
information.]
Hierarchy of Name Servers
• The solution to these problems is to distribute the
information among many computers called DNS servers.
• We create many sub DNS server based on the
requirement[each divided into sub domain]
Zone and domain
• When a server dedicated for (responsible) over is called a
zone.
Root server
• A root server is a server, whose zone consists of the whole
tree.
• A root server usually does not store any information but
authority to other servers.
Primary server and secondary servers
• DNS defines two types of servers:
• A primary server -stores a file about the zone, responsible
for creating , maintaining, and updating the zone file.
• A secondary server – that transfers the complete
information about a zone from another server and store the
file on its local disk.
DNS in the Internet
• In the internet, the domain space(tree) is divided into three
different section:
• Generic domains
• Country domains
• Inverse domains
Generic domains
• It define registered hosts according to their generic
behaviour.
• WWW was constructed originally by a small group of people led by
Tim Berners Lee at CERN, in 1989 and in 1991 this was released to
the world.
1. WWW is a distributed client/server service, in which a client
(Browsers such as IE, Firefox, etc.) can access services at a server
(Web server such as IIS, Apache).
WWW –World Wide Web
1. The service provided is distributed
over many locations called sites.
2. A new protocol for the Internet and a
system of document access to use it
was proposed and named as WWW.
3. Web is a vast collection of data,
information, software and protocols ,
spread across the world in web
servers, which are accessed by client
machines by browsers through the
Internet.
• This system allows document search and retrieval from any part of the
Internet.
• The documents were having Hypertext as the content
• The units of information on the web can be referred to as pages,
documents or resources.
• A document can contain text, images, sound and video, together
called Hypermedia.
Hypermedia
COMPONENTS OF THE WEB (WWW)
Structural Components
1. Web Clients/Web Browsers
2. Web Servers – run on sophisticated hardware
3. Internet – the global infrastructure which facilitates data transfer.
Semantic Components
1. Hyper Text Transfer Protocol (HTTP)
2. Hyper Text Markup Language (HTML)
3. eXtensible Markup Language (XML)
4. Uniform Resource Identifiers (URIs)
WEB CLIENTS (BROWSERS)
1. A browser is a software on the client on the web
which initiates the communication with the server.
2. Each browser usually consists of three parts: a Browser
controller, client protocols, and interpreters.
3. The controller receives input from the keyboard or
the mouse and uses the client programs to access Client
the document. After the document has been Controller Interpreters
protocols
accessed, the controller uses one of the interpreters
to display the document on the screen.
4. Examples are Internet Explorer, Mozilla FireFox,
Netscape Navigator, Safari etc.
WEB SERVERS
1. All the communication between the web client and a web server use the
standard protocol called as HTTP.
2. Web server informs its operating system to accept incoming network
connections using a specific port on the machine.
3. The server also runs as a background process.
4. A client (browser) opens a connection to the server, sends a request,
receives information from server and closes the connection.
5. Web server monitors a communications port on its host machine, accepts
the http commands through it and performs specified operations.
6. HTTP commands include a URL specifying the host machine.
7. The URL received is translated into either a filename or a program name,
accordingly the requested file or the output of the program execution is
sent back to the browser.
Proxy Server
• A Proxy server is a computer that keeps copies of responses to recent
requests.
1. The web client sends a request to the proxy server.
2. The proxy server checks its cache.
3. If the response is not stored in the cache, the proxy server sends
the request to the corresponding server.
1. Incoming responses are sent to the proxy server and stored for
future requests from other clients.
2. The proxy server reduces the load on the original server, decreases
traffic, and improves latency.
3. However, to use the proxy server, the client must be configured to
access the proxy instead of the target server.
4. The proxy server acts as both server and client.
5. When it receives a request from a client for which it has a response,
it acts as a server and sends the response to the client.
6. When it receives a request from a client for which it does not have a
response, it first acts as a client and sends a request to the target
server.
7. When the response has been received, it acts again as a server and
sends the response to the client.
EMAIL (SMTP, MIME,
IMAP, POP)
1. One of the most popular Internet
services is electronic mail (E-mail).
2. Email is one of the oldest network
applications.
3. When the sender and the receiver
of an e-mail are on the same
system, we need only two User
Agents and no Message Transfer
Agent
4. When the sender and the receiver
of an e-mail are on different
system, we need two UA, two pairs
of MTA (client and server), and two
MAA (client and server).
EMAIL (SMTP, MIME, IMAP, POP)
The three main components of an Email are
1. User Agent (UA)
2. Message Transfer Agent (MTA) – SMTP
3. Message Access Agent (MAA) - IMAP , POP
Ali B
ce o
1. When Alice needs to send a message to Bob, she runs a UA program to
prepare the message and send it to her mail server.
2. The mail server at her site uses a queue (spool) to store messages waiting
to be sent.
3. The message, however, needs to be sent through the Internet from
Alice’s site to Bob’s site using an MTA.
4. Here two message transfer agents are needed: one client and one server.
5. The server needs to run all the time because it does not know when a
client will ask for a connection.
6. The client can be triggered by the system when there is a message in the
queue to be sent.
7. The user agent at the Bob site allows Bob to read the received message.
8. Bob later uses an MAA client to retrieve the message from an MAA server
running on the second server.
A user agent is a software
package that composes, reads,
replies to, and forwards
messages. It also handles local
mailboxes on the user
computers.
Command driven
1. Command driven user agents
belong to the early days of
electronic mail.
2. A command-driven user
agent normally accepts a one
character command from the
keyboard to perform its task.
3. Some examples of command
driven user agents are mail,
pine, and elm.
GUI-based
1. Modern user agents are
GUI-based.
2. They allow the user to interact
with the software by using both
the keyboard and the mouse.
3. They have graphical
components such as icons,
menu bars, and windows that
make the services easy to
access.
4. Some examples of GUI-based
user agents are Eudora and
Outlook.
Multipurpose Internet Mail Extension (MIME)
● Electronic mail has a simple structure. Hence, it supports messages only in NVT 7-bit ASCII
format.Therefore, it cannot be used for languages such as french, german, chinese etc. Also, it
cannot be used to send binary files or video or audio files.
● MIME is supplementary protocols that allows non-ASCII data to be sent through e-mail
MIME header
It defines five headers that can be added to the orginal e-mail header section
to define the transformation parameters:
MIME Version
● This header defines the version of MIME used.
● The current version is 1.1
● MIME-Version:1.1
Content type
● This defines type of data
used in body.
● Content type and
subtype are separated
by slash.
● Depending on subtype,
header may contain
other parameters.
● MIME allows seven
different types of data
● Content-Type:<type /subtype; parameters
Content Transfer Encoding
● It defines method used to encode the messages into 0s and 1s for
transport:
● Content-Transfer-Encoding:<type>
Difference between IMAP & POP3
IMAP POP3

1. Clients are totally dependent on server. 1. It requires minimum use of server


resources.

2. Multiple mailboxes can be created on the 2. Only one mailbox can be created on
server. the server.

3. Designed to handle multiple clients. 3. Generally used to support single


client.

4. IMAP offers ability to search emails. 4. POP does not allow search facility.

5. It allows selective transfer of messages to 5. All the messages have to be


the client. downloaded.

6. Users can view the headings and sender 6. The e-mails are not downloaded
of e-mails and then decide to download. automatically.
IMAP POP3

7. Messages are accessed online 7.Messages are accessed offline.


although it also supports offline mode.

8.IMAP requires more internet usage time. 8.POP requires less internet usage time.

9. Suitable for accessing non-mail data i.e. 9.Not suitable for accessing non-mail
attachment. data.

10. Allows mails to be accessed from 10.Mails once downloaded cannot be


multiple locations. accessed from some other location.

11. IMAP commands are not abbreviated, 11.POP commands are generally
they are full. Eg. STATUS abbreviated into codes of three or four
letters. Eg. STAT
Audio and Video Streaming
AUDIO STREAMING OVERVIEW

• Audio File Features


• Audio Streaming Concept
• Audio Streaming Advantages
• Audio Streaming Applications
• Audio Streaming Format
• Audio Streaming Products
Audio File Features

• Audio file is a record of captured sound that can be


played back
• e.g. .WAV File
• Audio files are compressed for storage or faster
transmission
• Requires high bandwidth to transfer across the
network
Audio Streaming Concept

🖳 PC
Audio Format
LAN, Intranet,
Internet 🖳 PC

Windows Media
Streaming
.ASF
.WAV Software

Live Broadcast
Real Producer
Windows Media Encoder .RM
Real Producer 7.0
Audio Streaming Concept

• Analog-to-Digital modulation
• Streaming audio technologies relies on:
Sound sequences
Compression schemes
• Compression schemes (encoding) decreases the audio’s bandwidth
requirements:
Lowering the audio’s sampling rate
Filtering high frequencies
Performing other waveform
Audio Streaming Advantages

• Real time audio content.


• Low bandwidth media used.
• No waiting for downloading audio file.
• Internet users can enjoy a live online program.
Audio Streaming Applications

• Long-distance or automated training


• Seminars
• Concerts
• Speeches
• Music samples
• Online corporate messages
• Hear the news / Radio
Audio Formats
• Microsoft Windows Media Formats
• .avi, .asf, .asx, .rmi, .wav
• Moving Pictures Experts Group (MPEG)
• .mp3
• Musical Instrument Digital Interface (MIDI)
• .mid, .rmi
• Apple Quick Time, Macintosh AIFF Resource
• .qt, .aif, .aifc, .aiff, .mov
• UNIX Formats
• .au, .snd
Audio Streaming Products

• Window Media Technologies (Microsoft)


• RealSystem G2 (RealNetworks)
• Shockwave Streaming Audio (Macromedia)
• IBM Bamba (IBM)
• Streamworks (Xing Technology)
• Media Player (Netscape)
Windows Media Technologies
by Microsoft
• Leading digital media platform.
• Windows Media Technologies consist of :
• Windows Media Player
• Windows Media Services
• Windows Media Tools
• Windows Media SDK
• Free download at
http://www.microsoft.com/windows/windowsmedi
a/
Windows Media Technologies

• Windows Media Audio codec provides


FM-radio-quality sound at half the bit rate of MP3
• Integration with other Microsoft products
(Windows NT Server, Microsoft Site Server,
Microsoft BackOffice)
• Digital rights management
• Advanced Compression Technology Broadcasting
WMT Advantages

• Wide bandwidth range


• Intelligent streaming
• Multiple bit rate encoding
• High scalability
• Built-in multicast service
• Seamless stream switching
• Easy Internet Radio Distribution
Real Networks

• High quality streaming audio at all bandwidths on


both the Internet and corporate Intranets.
• Support realtime and on-demand, all sounds
(stereo and mono)
• Take advantage of key features of Window 2000
(load balancing, clustering, stability)
• Operating systems as Window NT, Linux, Sun
Solaris
Real System G2 Products & Advantages

• RealPlayer 7
• Over 150 live radio stations built-in, superb audio
• RealProducer 7
• Streaming Software; Efficient encoding; Reach the
widest possible audience; choice of operating systems
• RealPresenter G2
• Live/recorded capability; Presentation Manager
RealSystem G2 Products & Advantages

• RealSlideshow 2
• Combine pictures with music or speech, customize the layout of presentation
• RealServer 7
• 60 simultaneous sessions of live or on-demand streaming; Near CD quality
Internet audio
• Free download at:
• http://www.realnetworks.com/products/
Video Streaming
• Video Streaming Objective
• Streaming Advantages
• Video Streaming Architecture
• Compression and Decompression-codec
• MPEG 1-4 Introduction
• Major Products and Features Comparison
Video Streaming Objective

• The object is to overcome the negative effects of physical distance


and network technology limitation.
Streaming Advantages

• Reduce setup time


• Reduction in client storage requirement
• Video can be viewed in real time
• Transmission signals over low bandwidth facilities
Video Streaming Architecture
• Content Creation/Capture
• Content Management
• Content Formatting (Compression)
• Delivery
• Distribution
• Presentation (Viewing)
• View Control
Video Capture

• Converting analog to video signals


• A special video capture card to convert the analog
signals to digital form and compresses the data.
• Also digital video devices that can capture images and
transfer to a computer
Content Management

• Critical in video server


• The purpose including create, collect, catalog,
organize, store, and access to massive multimedia
information database
Video Input Formats

• AVI • MPEG
• ActiveMovie • QuickTime
• Cinepak • RealVideo
• Indeo • Video for Windows
• motion-JPEG • XGA
Video Formats
AVI & ASF

• Developed by Microsoft
• AVI (Audio Video Interleaved)
- limited to 320x240 resolution
- 30 frames per second
• ASF (Advanced Streaming Format)
- Has been submitted to ISO for standardization
- Expected to replace AVI format
Codec
(Compressor/Decompressor)
• Coding techniques to compress video data
• The newest codec change their sampling rate as they run
• Choice of codec is the biggest factor to determine the bandwidth
needed to connect the server and receive content
• Many of the codecs follow international standards
Content Compression
• MPEG (A working group of ISO)
- The most common standard for video
compression and file formats
- Generally produce better quality video than other
formats
- High compression rate
- MPEG1, MPEG2 and MPEG4
MPEG-1

• MPEG-1 was designed for coding progressive video


at a transmission rate of about 1.5 million bits per
second.
• It was designed specifically for Video-CD and CD-i
media.
• MPEG-1 audio layer-3 (MP3) has also evolved from
early MPEG work.
MPEG-2
• MPEG-2 was designed for coding interlaced images at transmission
rates above 4 million bits per second.
• MPEG-2 is used for digital TV broadcast and
DVD.
• An MPEG-2 player can handle MPEG-1 data as well.
MPEG-3

• A proposed MPEG-3 standard, intended for High


Definition TV (HDTV), was merged with the
MPEG-2 standard when it became apparent that
the MPEG-2 standard met the HDTV requirements.
MPEG-4

• An MPEG-4 standard is in the final stages of


development and release.
• It is a much more ambitious standard and
addresses speech and video synthesis, fractal
geometry, computer visualization, and an artificial
intelligence (AI) approach to reconstructing
images.
Major Products

• Microsoft Windows Media Technologies


http://www.microsoft.com/windows/windowsmedia
/

• RealSystem G2
http://www.realnetwork.com
Comparison
WMT –vs- RealSystem G2
• Head to head comparison
Feature Comparison

• More Information
http://www.microsoft.com/windows/windowsmedia/
Comparison
WMT –vs- RealSystem G2

• Cost Analysis
- Prepared by Approach, Inc.,
• Key findings
- Both streaming products results in positive
returns on investment
- Microsoft solution is more economical than the
RealNetwork solution
• Download in Word format
Audio Streaming Architecture

• Creating Audio File


• Demonstration of Streaming Software
• Demo of Streaming Process
• Windows Media Encoder
• RealProducer 7 Basic
• Play the Audio File
Creating Audio File

• Record From File


• Audio files located in your hard drive
• Record Form Media Device
• Media device such as Microphone, CD Player, PC
Camera, etc.
• Live Broadcast
• Broadcast live media stream from your computer
Installation of Streaming Software

• Windows Media Tools


• Windows Media Encoder
• RealSystems G2
• RealProducer 7 Basic
Windows Media Technologies

Download Windows Media Tools

http://www.microsoft.com/windows/windowsmedia
RealSystem G2
Download RealProducer

http://www.realnetworks.com/products/producer/
Playing Audio File

• Windows Media Player


• RealPlayer
Windows Media Player 6.4

http://www.microsoft.com/windows/windowsmedia/
Download RealPlayer

http://www.real.com/player/index
Real Player 7.0 Basic
Video Streaming Presentation

• Active Streaming Format (ASF)


- MS Defacto standard for streaming video.
• Real Media (RM)
- Real’s standard for streaming video
Video Streaming
• Codec selections from Real Media.
Video Streaming
• Codec Selections from Windows Media.
Video Streaming

Streaming with Real Producer.

• Real Producer.
- C:\Program Files\REAL\RealProducer\realprod.exe
Video Streaming

Streaming with Windows Media Encoder .

• Windows Media.
- C:\Program Files\Windows Media Components\Tools\NsRex.exe
Video Streaming

• Using Windows Media Player.


- C:\Program Files\Windows Media Player\mplayer2.exe
Video Streaming

• Streamed file size comparison.


- C:\WINDOWS\EXPLORER.SCF

• Unstreamed *.AVI file = 155,290 KB


• RealMedia Streamed file *.RM = 483 KB
• Windows Media Streamed file *.ASF = 1,283 KB
Video Streaming Statistics
Video Streaming Statistics
Video Streaming

• Live feed Video Capture.


- C:\Program Files\Logitech\Logitech QuickCam\QuickCam.exe

• Stream from live feed.


- C:\Program Files\REAL\RealProducer\realprod.exe
- C:\Program Files\Windows Media Components\Tools\NsRex.exe
Audio/Video Streaming Summary

• Capture Audio/Video
• Create your file
• Install the streaming software
• Windows Media Tools
http://www.microsoft.com/windows/windowsmedia/
• RealProducer 7 Basic http://www.realnetworks.com/products/
Audio/Video Streaming Summary

• Play the Audio Stream File

• Windows Media Player 6.4


http://www.microsoft.com/windows/windowsmedia/

• RealPlayer 7 Basic
http://www.real.com/player/index

You might also like