0% found this document useful (0 votes)
4 views190 pages

Module 5- Networks

The document outlines the Transport Layer protocols, including User Datagram Protocol (UDP) and Transmission Control Protocol (TCP), detailing their functionalities, service models, and applications. It explains the transport service primitives, the Berkeley Socket Model, and the differences between connection-oriented and connectionless services. Additionally, it covers the importance of TCP for reliable data transmission and the structure of TCP and UDP headers, along with their respective applications in real-time multimedia and remote procedure calls.

Uploaded by

SHEENA Y
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)
4 views190 pages

Module 5- Networks

The document outlines the Transport Layer protocols, including User Datagram Protocol (UDP) and Transmission Control Protocol (TCP), detailing their functionalities, service models, and applications. It explains the transport service primitives, the Berkeley Socket Model, and the differences between connection-oriented and connectionless services. Additionally, it covers the importance of TCP for reliable data transmission and the structure of TCP and UDP headers, along with their respective applications in real-time multimedia and remote procedure calls.

Uploaded by

SHEENA Y
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

MODULE V

Syllabus
• Transport service – Services provided to the upper layers,
Transport service primitives.
• User Datagram Protocol (UDP).
• Transmission Control Protocol (TCP) – Overview of
TCP, TCP segment header, Connection establishment
&release, Connection management modelling, TCP
retransmission policy, TCP congestion control.

• Application Layer –File Transfer Protocol (FTP), Domain


Name System (DNS), Electronic mail, Multipurpose
Internet Mail Extension (MIME), Simple Network
Management Protocol (SNMP), World Wide Web(WWW)
– Architectural overview.
TRANSPORT LAYER

Services provided to upper layers


• Ultimate goal of transport layer- To provide efficient,
reliable and cost-effective services to its users, normally
processes in application layer.

• TL makes use of services provided by network layer.

• Hardware and/or software within TL that does the work


is called ‘transport entity’.

• Transport entity can be located in OS kernel, in a


separate user process, in a library package or in NIC etc.
N/w, Transport and application
layers-Relationship
• Network layer- 2 types of services.
• Connection oriented and connectionless.

• So, in TL also, 2 types of transport services.-Connection


oriented and connectionless.

• Bottom 4 layers are Transport service providers.


• i.e., PL,DL, N/w, Transport
• Upper layers are Transport service users
• i.e., AL,PL,SL.
Transport service primitives
• To allow users to access the transport service, TL must provide
some operations to application programs, i.e., a transport
service interface.
• Transport service is similar to network service. But, some
differences.
• 1.
• N/w service is intended to model service offered by real
networks. Real n/ws can lose packets and hence, n/w service
is unreliable.
• Transport service(connection-oriented) is reliable.
• Ex. UNIX pipe communication.
• It can provide unreliable service also.
• 2. N/w service is used only by the transport entities.
• But, transport services are seen by many programs
and their programmers.
• Therefore, transport service must be convenient and
easy to use.
Primitives-SIMPLE MODEL
• A simple transport service has 5 primitives.
• These are called by applications to transport data.
• CONNECT primitive
• DISCONNECT primitive
• -Can be symmetric or asymmetric.
• What is TPDU???
• TPDU-Transport Protocol Data Unit
BERKELEY SOCKET MODEL
• Another set of primitives used in Berkeley UNIX for
TCP.
• Widely used for internet programming.
• First 4 primitives are executed in that order by the server.

• SOCKET primitive creates a new end point and allocates table space
for it within the transport entity.

• Parameters of call
• → Specify addressing format to be used.
• →type of service desired(Ex. Reliable byte stream)
• →Protocol

• A successful SOCKET call returns an ordinary file descriptor for use


in succeeding calls.
• Newly created sockets do not have network address.
• These are assigned using BIND primitive.
• Once a server has bound an address to a socket, remote
clients can connect to it.
• LISTEN call allocates space to queue incoming calls(if more
than one client tries to access same server).
• Socket model LISTEN won’t block server, as in our first simple
set of primitives.
• Then, server executes an ACCEPT primitive(which blocks
waiting of client).( A file descriptor is returned)
• Connection is established.
• Both can now call SEND/RECV primitives.
principle
An example of socket programming:

internet file server


• INTERNET TRANSPORT PROTOCOL-

• UDP
▪ UDP (User Datagram Protocol)
▪ Connectionless transport protocol
▪ UDP is basically just an internet packet with a short header
added
▪ Provides a way for applications to send encapsulated IP
datagrams and send them without having to establish a
connection
▪ UDP transmits segments consisting of an 8-byte header
followed by the payload
Fig: The UDP header
▪ UDP transmits segments consisting of an 8-byte header
followed by the payload.
▪ Two ports are used 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.
▪ This attachment occurs when BIND primitive is used
▪ Without the port fields, the transport layer would not
know what to do with the packet.
▪ With ports, it delivers segments correctly
▪ source port is primarily needed when a reply must be
sent back to the source
• Main value of having UDP over IP is the addition of
source and destination ports.
▪ UDP length field includes the length of 8-byte
header and the data
▪ UDP checksum is optional and stored as 0 if not
computed
▪ UDP does not do
▪ flow control,
▪ error control, or
▪ retransmission upon receipt of a bad segment
Applications of udp

▪ Mechanism used is: client-server


▪ client sends a short request to the server and
expects a short reply back
▪ Eg: DNS, RPC, RTP
UDP application-1

• 1. DNS
▪ Program that needs to look up the IP address of some
host name can send a UDP packet containing the host
name to a DNS server.
▪ The server replies with a UDP packet containing the
host's IP address.
▪ No setup is needed in advance and no release is needed
afterward.
UDP APPLICATION-2
• 2. Remote Procedure Call (RPC)
• UDP is widely used for RPC
▪ When a process on machine 1 calls a procedure on
machine 2, the calling process on 1 is suspended and
execution of the called procedure takes place on 2.
▪ Information can be transported from the caller to the
callee in the parameters and can come back in the
procedure result.
▪ No message passing is visible to the programmer.
▪ This technique is known as RPC (Remote Procedure
Call)
RPC figure
▪ Remote Procedure Call
▪ Steps in making an RPC
1. client calling the client stub.
• This call is a local procedure call, with the parameters
pushed onto the stack in the normal way.
2. client stub packing the parameters into a message and
making a system call to send the message.
• Packing the parameters is called marshaling.
3. kernel sending the message from the client machine to the
server machine.
4. kernel passing the incoming packet to the server stub.
5. server stub calling the server procedure with the
unmarshaled parameters.
• The reply traces the same path in the other direction.
▪ Problems faced by RPC
1. passing pointers is impossible because the client and server
are in different address spaces.
▪ Trick to overcome this
▪ standard calling sequence of call-by-reference has
been replaced by copy-restore.
▪ this trick does not always work, for example, if the
pointer points to a graph or other complex data
structure
2. computes the inner product of two vectors (arrays), without
specifying how large either one is
• marshalling the parameters has no way of determining
how large they are.
3. not always possible to deduce the types of the parameters
• example is printf,
• which may have any number of parameters with a
mixture of integers, shorts, longs, characters, strings,
floating-point numbers of various lengths, and other
types.
• Trying to call printf as a remote procedure would be
practically impossible
4. use of global variables
• code will fail because the global variables are no longer
shared
• Still UDP is commonly used for RPC
UDP Application-3
• 3. UDP is widely used in another area called real-time multimedia
applications
• Egs:
• Internet radio,
• Internet telephony,
• music-on-demand,
• videoconferencing,
• video-on-demand
• Generic real-time transport protocol for multiple applications
called RTP (Real-time Transport Protocol) was born
• Basic function of RTP is to multiplex several real-time data
streams onto a single stream of UDP packets
• Working of RTP:
• Multimedia application consists of multiple audio,
video, text, and possibly other streams.
• These are fed into the RTP library, which is in user space
along with the application.
• This library then multiplexes the streams and encodes
them in RTP packets, which it then stuffs into a socket.
• At the other end of the socket (in the operating system
kernel), UDP packets are generated and embedded in IP
packets.
• If the computer is on an Ethernet, the IP packets are
then put in Ethernet frames for transmission.
• It is a transport protocol that is implemented in the application
layer
Fig: (a) The position of RTP in the protocol stack.
(b) Packet nesting.
Fig: RTP header
RTP Packet fields
• Version field
• already at 2
• P bit
• indicates that the packet has been padded to a multiple of 4
bytes.
• last padding byte tells how many bytes were added
• X bit
• indicates that an extension header is present.
• The format and meaning of the extension header are not
defined
• CC field
• tells how many contributing sources are present, from 0 to
15
• M bit
• an application-specific marker bit.
• It can be used to mark
• start of a video frame,
• start of a word in an audio channel,
• Payload type field
• tells which encoding algorithm has been used
• (e.g., uncompressed 8-bit audio, MP3, etc.).
• Since every packet carries this field, the encoding can change
during transmission.
• Sequence number
• a counter that is incremented on each RTP packet sent.
• It is used to detect lost packets.
• Timestamp
• produced by the stream's source to note when the first
sample in the packet was made.
• This value can help reduce jitter at the receiver.
• Synchronization source identifier
• tells which stream the packet belongs to.
• It is the method used to multiplex and demultiplex multiple
data streams onto a single stream of UDP packets.
• Contributing source identifiers,
• used when mixers are present in the studio.
• In that case, the mixer is the synchronizing source, and the
streams being mixed are listed here.
• RTP has a little sister protocol called RTCP (Realtime
Transport Control Protocol).
• It handles feedback, synchronization, and the user
interface but does not transport any data.
1. feedback on delay, jitter, bandwidth, congestion, and other
network properties to the sources
• used by the encoding process
• to increase the data rate (and give better quality)
when the network is functioning well and
• to cut back the data rate when there is trouble in
the network.
2. RTCP also handles interstream synchronization.
• The problem is that different streams may use different
clocks, with different granularities and different drift
rates.
• RTCP can be used to keep them in sync

3. RTCP provides a way for naming the various sources (e.g., in


ASCII text).
• This information can be displayed on the receiver's
screen to indicate who is talking at the moment.
• INTERNET TRANSPORT PROTOCOL-

• TCP
• For most of the internet applications, reliable, sequenced delivery
is needed
• UDP cannot provide this, so another protocol is required.
• It is called TCP (Transmission Control Protocol)
• TCP was designed to
• provide a reliable end-to-end byte stream over an unreliable
internetwork
• dynamically adapt to properties (different topologies,
bandwidths, delays, packet sizes, etc) of the internetwork
• be robust in the face of many kinds of failures
• Each machine supporting TCP has a TCP transport entity, either a
library procedure, a user process, or part of the kernel.
• A TCP entity accepts user data streams from local processes, breaks
them up into pieces not exceeding 64 KB and sends each piece as a
separate IP datagram.
• When datagrams containing TCP data arrive at a machine, they are
given to the TCP entity, which reconstructs the original byte
streams.
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 port is the TCP name for a TSAP.
• For TCP service to be obtained, a connection must be explicitly
established between a socket on the sending machine and a
socket on the receiving machine.
• A socket may be used for multiple connections at the same
time.
• Connections are identified by the socket identifiers at both
ends, that is, (socket1, socket2)
Internet Transport Protocols: TCP

48
Internet Transport Protocols: TCP
• Port numbers below 1024 are called well-known ports and are
reserved for standard services.

Fig: Some assigned ports.


• All TCP connections are full duplex and point-to-point.
• Full duplex
• traffic can go in both directions at the same time.
• Point-to-point
• each connection has exactly two end points.
• TCP does not support multicasting or broadcasting.
• TCP connection is a byte stream, not a message stream.
• Message boundaries are not preserved end to end.
• For example, if the sending process writes four 512-byte
to a TCP stream, these data may be delivered to the
receiving process as four 512-byte chunks, two 1024-
byte chunks, one 2048-byte chunk
• There is no way for the receiver to detect the unit(s) in
which the data were written
• To force data out immediately, applications can use the PUSH flag,
which tells TCP not to delay the transmission
• URGENT flag causes TCP to stop accumulating data and transmit
everything it has for that connection immediately
• The end of the urgent data is marked so the application knows
when it is over.
TCP Protocol

• Key feature of TCP


• Every byte on a TCP connection has its own 32-bit
sequence number
• Sending and receiving TCP entities exchange data in the
form of segments
TCP HEADER
• 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.
• can accumulate data from several writes into one segment or
• can split data from one write over multiple segments.
• Two limits restrict the segment size.
• each segment including the TCP header, must fit in the 65,515-
byte IP payload.
• each network has a Maximum Transfer Unit, or MTU and each
segment must fit in the MTU.
• Basic protocol used by TCP entities is the sliding window protocol
• TCP Segment Header
• Every segment begins with a fixed-format, 20-byte header.
• The fixed header may be followed by header options.
• After the options, if any, up to 65,535 - 20 - 20 = 65,495 data
bytes may follow,
• where the first 20 refer to the IP header and
• the second to the TCP header.
• Segments without any data are legal and are commonly used
for acknowledgements and control messages.
Internet Transport Protocols: TCP

Fig: TCP header


TCP header Fields

• 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
• Sequence number and Acknowledgement number fields
• Perform their usual functions
• Ack no. 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
TCP header length
• Tells how many 32-bit words are contained in the TCP header.
• This information is needed because the Options field is of
variable length
• Technically, this field really indicates the start of the data within
the segment, measured in 32-bit words
six 1-bit flags
• URG bit
• 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.
• ACK bit
• set to 1 to indicate that the Acknowledgement number is valid.
• If ACK is 0, the segment does not contain an acknowledgement
so the Acknowledgement number field is ignored.
• 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
• RST bit
• used to reset a connection that has become confused due to a
host crash or some other reason.
• also used to reject an invalid segment or refuse an attempt to
open a connection.
• SYN bit
• used to establish connections.
• The CONNECTION REQUEST has SYN = 1 and ACK = 0 to indicate
that the piggyback acknowledgement field is not in use.
• The CONNECTION ACCEPTED reply does bear an
acknowledgement, so it has SYN = 1 and ACK = 1.
Internet Transport Protocols: TCP
• FIN bit
• used to release a connection.
• It specifies that the sender has no more data to transmit.
• Window size field
• tells how many bytes may be sent starting at the byte
acknowledged.
• Flow control in TCP is handled using a variable-sized sliding
window which gives additional flexibility
• A Window size field of 0 is legal
• It says that the bytes up to and including Acknowledgement
number - 1 have been received,
• but that the receiver is currently badly in need of a rest and
would like no more data.
• The receiver can later grant permission to send by transmitting a
segment with the same Acknowledgement number and a nonzero
Window size field.

• Checksum field
• Provided for extra reliability.
• It checksums the header, the data, and the conceptual
pseudoheader shown in Fig.
Fig: pseudoheader included in the TCP checksum
• When performing this computation,
• TCP Checksum field is set to zero and
• data field is padded out with an additional zero byte if its
length is an odd number.
• checksum algorithm is
• simply to add up all the 16-bit words in one's complement
and then
• to take the one's complement of the sum.
• As a consequence, when the receiver performs the
calculation on the entire segment, including the Checksum
field, the result should be 0.
Internet Transport Protocols: TCP

Fig: TCP header


• Options field
• Provides a way to add extra facilities not covered by the regular
header.
• Most important option is the one that allows each host
to specify the maximum TCP payload it is willing to
accept.
• During connection setup, each side can announce its
maximum and see its partner's.
• If a host does not use this option, it defaults to a
536-byte payload.
• All Internet hosts are required to accept TCP
segments of 536 + 20 = 556 bytes
• Window scale option was proposed, allowing the sender and
receiver to negotiate a window scale factor.
• This number allows both sides to shift the Window size field
up to 14 bits to the left, thus allowing windows of up to 230
bytes.
• Most TCP implementations now support this option
• Another option proposed and now widely implemented is the
use of the selective repeat instead of go back n protocol.
• NAKs are introduced to allow the receiver to ask for a
specific segment.
• After it gets these, it can acknowledge all the buffered data,
thus reducing the amount of data retransmitted.
TCP Connection Establishment

• Connections are established in TCP by means of the three-way


handshake

Fig: (a) TCP connection establishment in the normal case.


(b) Call collision.
TCP Connection Release
• To release a connection, either party can send a TCP segment
with the FIN bit set, which means that it has no more data to
transmit.
• When the FIN is acknowledged, that direction is shut down for
new data.
• When both directions have been shut down, the connection is
released.
• Normally, four TCP segments are needed to release a
connection, one FIN and one ACK for each direction.
• However, it is possible for the first ACK and the second FIN to
be contained in the same segment, reducing the total count to
three.
• TCP connection management modelling
• TCP Transmission Policy
• TCP Congestion Control
TCP Connection Management
Modelling
TCP Transmission Policy

Fig: Window
management in
TCP.
Silly window syndrome
• Silly Window Syndrome is a problem that arises due to poor implementation
of TCP.
• It degrades the TCP performance and makes the data transmission extremely
inefficient.
• This problem occurs when data are passed to the sending TCP
entity in large blocks, but an interactive application on the
receiving side reads data 1 byte at a time.

• The problem is called so because:

• It causes the sender window size to shrink to a silly value.

• The window size shrinks to such an extent where the data being transmitted is
smaller than TCP Header.
Internet Transport Protocols: TCP
• Silly window syndrome
• Problem that can degrade TCP performance
• This problem occurs when data are passed to the sending TCP
entity in large blocks, but an interactive application on the
receiving side reads data 1 byte at a time.
• Initially, the TCP buffer on the receiving side is full and the
sender knows this (i.e., has a window of size 0).
• Then the interactive application reads one character from the
TCP stream.
• This action makes the receiving TCP to send a window update
to the sender saying it to send 1 byte.
• The sender sends 1 byte.
• The buffer is now full, so the receiver acknowledges the 1-byte
segment but sets the window to 0.
80
• This behavior can go on forever.
• Silly window syndrome

81
• What are the causes?
The two major causes of this syndrome are as
follows:

• Sender window transmitting one byte of data


repeatedly.

• Receiver window accepting one byte of data


repeatedly.
2 Solutions

1. Nagle’s algorithm
2. Clark’s solution
Nagle's algorithm
• When data come into the sender one byte at a time, just send
the first byte and buffer all the rest until the outstanding byte
is acknowledged.
• Then send all the buffered characters in one TCP segment and
start buffering again until they are all acknowledged.

84
• If the user is typing quickly and the network is slow, a
substantial number of characters may go in each
segment, greatly reducing the bandwidth used.
• The algorithm additionally allows a new packet to be
sent if enough data have trickled in to fill half the
window or a maximum segment
• Nagle's algorithm is widely used by TCP
implementations
• Clark's solution is to prevent the receiver from sending a window
update for 1 byte.
• The receiver must wait until it can handle the maximum
segment size it advertised when the connection was
established or until its buffer is half empty
• 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 taking the data up from TCP a byte at a time.
• Both solutions are valid and can work together.
• Goal is for the sender not to send small segments and the
receiver not to ask for them.
• TCP Congestion Control
• When the load offered to any network is more than it can
handle, congestion builds up.
• 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.
• Congestion policy in TCP –
• 1. Slow Start Phase: starts slowly increment is exponential to
threshold
• 2. Congestion Avoidance Phase: After reaching the threshold
increment is by 1
• 3. Congestion Detection Phase: Sender goes back to Slow start
phase or Congestion avoidance phase.
• Begins with Slow start phase.
• Additive Increase Multiplicative Decrease strategy.
• 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.
• If this segment is acknowledged before the timer goes off, it
sends two segments.
• As each of these segments is acknowledged, the congestion
window is increased by one maximum segment size.
• When the congestion window is n segments, if all n are
acknowledged on time, the congestion window is increased by
the byte count corresponding to n segments.
• In effect, each burst acknowledged doubles the congestion
window.
• congestion window keeps growing exponentially until either a
timeout occurs or the receiver's window is reached.
• This algorithm is called slow start, but it is not slow at all
• It is exponential.
• All TCP implementations are required to support it.
• Internet congestion control algorithm:
• It 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.
• Slow start is then used to determine what the network can
handle, except that exponential growth stops when the
threshold is hit.
Tcp congestion control
• TCP Timer Management
• TCP uses multiple timers
1. 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

RTT - Round Trip Time


D - Standard Deviation
• One problem that occurs with the dynamic estimation of RTT is
what to do when a segment times out and is sent again.
• When the acknowledgement comes in, it is unclear whether the
acknowledgement refers to the first transmission or a later one.
• Solution is called Karn's algorithm.
• do not update RTT on any segments that have been
retransmitted.
• Instead, the timeout is doubled on each failure until the
segments get through the first time.
• Most TCP implementations use it
2. persistence timer:
• designed to prevent the following deadlock.
• The receiver sends an acknowledgement with a window size of
0, telling the sender to wait.
• Later, the receiver updates the window, but the packet with the
update is lost.
• Now both the sender and the receiver are waiting for each
other to do something.
• When the persistence timer goes off, the sender transmits a
probe to the receiver.
• The response to the probe gives the window size.
• If it is still zero, the persistence timer is set again and the cycle
repeats.
• If it is nonzero, data can now be sent.
3. 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.
• This feature is controversial because it adds overhead and may
terminate an otherwise healthy connection due to a temporary
network partition.
4. Timer used in the TIMED WAIT state while closing
• It runs for twice the maximum packet lifetime to make sure that
when a connection is closed, all packets created by it have died
off.
• Transactional TCP (T/TCP) handles client-server interactions with a
reduced number of packets

98
• APPLICATION LAYER

File transfer protocol


(FTP)
• File Transfer Protocol (FTP) is the standard mechanism
for one of the most common tasks on the Internet,
copying a file from one computer to another.
• FTP differs from other client-server applications in that it
establishes two connections between the hosts.
• One connection is used for data transfer, the other for
control information (commands and responses).
• Separation of commands and data transfer makes FTP
more efficient. The control connection uses very simple
rules of communication.
• We need to transfer only a line of command or a line of
response at a time.
• Figure shows the basic model of FTP.
• The client has three components: the user interface,
the client control process, and the client data
transfer process.
• The server has two components: the server control
process and the server data transfer process.
• The control connection is made between the control
processes.
• The data connection is made between the data
transfer processes.
• The two FTP connections control and data use different
strategies and different port numbers.
• Because FTP uses a separate control connection, FTP is said to
send its control information out-of-band.
• HTTP, sends request and response header lines into the same
TCP connection that carries the transferred file itself. For this
reason, HTTP is said to send its control information in-band.
• The control connection remains open during the entire
interactive FTP session. Port number is well-known port 21
• The data connection is opened and then closed for each file
transferred. It opens each time commands that involve
transferring files are used, and it closes after the file is
transferred. Data connection uses well-known port 20 at the
server site.
Working of FTP-steps
1. When a user starts an FTP session with a remote host, the client side of FTP
(user) first initiates a control TCP connection with the server side (remote
host) on server port number 21.
2. The client side of FTP sends the user identification and password over this
control connection.
3. The client side of FTP also sends, over the control connection, commands
to change the remote directory.
4. When the server side receives a command for a file transfer over the
control connection (either to, or from, the remote host), the server side
initiates a TCP data connection to the client side.
5. FTP sends exactly one file over the data connection and then closes the
data connection.
• If, during the same session, the user wants to transfer another file, FTP
opens another data connection.
• Thus, with FTP, the control connection remains open throughout the
duration of the user session, but a new data connection is created for each
file transferred within a session (that is, the data connections are non-
persistent).
FTP commands and replies:
• The commands, from client to server, and replies, from server to client, are
sent across the control connection in 7-bit ASCII format.
• Each command consists of four uppercase ASCII characters, some with
optional arguments. Some of the more common commands are given
below:

• • USER Used to send the user identification to the server.
• • PASS Used to send the user password to the server.
• • LIST Used to ask the server to send back a list of all the files in the
current remote directory. The list of files is sent over a (new and non-
persistent) data connection rather than the control TCP connection.
• • RETR filename: Used to retrieve (that is, get) a file from the current
directory
• of the remote host. This command causes the remote host to initiate a data
connection and to send the requested file over the data connection.
• • STOR filename: Used to store (that is, put) a file into the current
directory of the remote host.
FTP-Transmission modes
• FTP can transfer a file across the data connection by using one of
the following three transmission modes: stream mode, block
mode, and compressed mode.
• The stream mode is the default mode. Data are delivered from
FTP to TCP as a continuous stream of bytes. TCP is responsible
for chopping data into segments of appropriate size. If the data
are simply a stream of bytes (file structure), no end-of-file is
needed. End-of-file in this case is the closing of the data
connection by the sender. If the data are divided into records
(record structure), each record will have a 1-byte endof-record
(EOR) character and the end of the file will have a I-byte end-of-
file (EOF) character.
• In block mode, data can be delivered from FTP to TCP in
blocks. In this case, each block is preceded by a 3-byte header.
The first byte is called the block descriptor; the next 2 bytes
define the size of the block in bytes.
• In the compressed mode, if the file is big, the data can be
compressed. The compression method normally used is run-
length encoding. In this method, consecutive appearances of a
data unit are replaced by one occurrence and the number of
repetitions. In a text file, this is usually spaces (blanks). In a
binary file, null characters are usually compressed.
DNS – DOMAIN NAME SYSTEM

• We use IP addresses to identify hosts and other


resources.
• These addresses are hard for people to remember.
• Ex. Sending mail to tina@[Link]
• ASCII names were introduced to identify machines.
• Humans-ASCII names. But, network understands only
numerical addresses.
• So, some mechanism is required to convert ASCII
strings to network addresses.
Essence of DNS
• Invention of a hierarchical, domain-based naming
scheme and a distributed database system for
implementing this naming scheme.

How DNS is used??


• To map a name onto an IP address, an application
program calls a library procedure called the “resolver”
passing it the name as a parameter.
• A directory service that translates hostnames to IP
addresses.
• This is the main task of the Internet’s domain name
system (DNS).
• The DNS is
• (1) a distributed database implemented in a
hierarchy of DNS servers,
• (2) an application-layer protocol that allows hosts
to query the distributed database.
Domain Name Space

• Conceptually, the Internet is divided into over 200


top-level domains, where each domain covers many
hosts.
• Each domain is partitioned into subdomains, and
these are further partitioned, and so on.
• All these domains can be represented by a tree, as
shown in Figure.
• The leaves of the tree represent domains that have
no subdomains
Table 17.1 Generic domain labels
• Top level domain come in two flavours: generic and
countries.
• Generic: com, edu, gov, mil, net, org etc.
• Countries: jp, in, us etc.
• Getting a second-level domain, such as name-of-
[Link], is easy. It requires to register for the
corresponding top-level domain (com in this case) to
check if the desired name is available and not somebody
else's trademark.

• Ex. studentX@[Link]
Domain
Meaning
Name
au Australia
in India
cl Chile
fr France
us United States
za South Africa
uk United Kingdom
jp Japan
es Spain
de Germany
ca Canada
ee Estonia
hk Hong Kong
• Each domain is named by the path upward from it to the
(unnamed) root.
• The components are separated by periods (pronounced
''dot''). Thus, the engineering department at Sun
Microsystems might be [Link].
• This will be different from [Link].
• Absolute Domain Name(Fully Qualified Domain
Name):
• Always end with a period(dot).
• Ex. “[Link].”

• Relative Domain Name(Partially Qualified Domain


Name):
• Relative names have to be interpreted in some
context to uniquely determine their true meaning.
• Domain names are case insensitive.
• i.e., Edu, edu and EDU are all same.
• Each domain controls how it allocates domains under it.
• For example, Japan has domains [Link] and [Link] that mirror
edu and com.
• Ex. [Link] → Yale university in US
• [Link] → Keio university in Japan.
• Aliases :
• An alias is a name defined to denote the same information
as another name.
• Ex.- [Link] and [Link]
Inverse domains
• The inverse domain is used to map an address to a name.
• This may happen, for example, when a server has received a
request from a client to do a task.
• Although the server has a file that contains a list of authorized
clients, only the IP address of the client (extracted from the
received IP packet) is listed.
• The server asks its resolver
➢ to send a query to the DNS server to map an address to a
name
➢ to determine if the client is on the authorized list.
• This type of query is called an inverse or pointer (PTR) query.
Host Name(Domain name)

Application
Resolver
Client
IP Address
Resource records

• Every domain, whether it is a single host or a top level


domain, can have a set of resource records associated
with it.
• For a single host, the most common resource record is
just its IP address, but many other kinds of resource
records also exist.
• When, a resolver gives a domain name to DNS, what it
gets back are the resource records associated with that
name.
• Primary function of DNS is to map domain names onto
resource records.
• Resource record is a five-tuple.
• Domain_name Time_to_live Class Type
Value
• The Domain_name tells the domain to which this record applies.
• The Time_to_live field gives an indication of how stable the record
is. Information that is highly stable is assigned a large value, such as
86400 (the number of seconds in 1 day). Information that is highly
volatile is assigned a small value, such as 60 (1 minute).
• The third field is Class. For Internet information, it is always IN. For
non-Internet information, other codes can be used.
• The Type field tells what kind of record this is. The most important
types are listed below
• Finally, value field. This field can be a number, a
domain name, or an ASCII string.
• Semantics depend on the record type.
Name Servers

• Database
• In theory, a single name server could contain the
entire DNS database and respond to all queries
about it.
• In practice, this server would be so overloaded.
• To avoid problems associated with having only a
single source of information, the DNS name space is
divided into non-overlapping zones.
Zones
• What a server is responsible for or has authority over is
called a zone.
• It can be defined as a contiguous part of the entire tree.
• The domain and the zone refer to the same thing.
• The server makes a database called a zone file and keeps
all the information for every node under that domain.
• The information about the nodes in the subdomains is
stored in the servers at the lower levels.
• The original server does not free itself from
responsibility totally: It still has a zone, but the detailed
information is kept by the lower-level servers
Root servers

• A root server is a server whose zone consists of the


whole tree.
• A root server usually does not store any information
about domains but delegates its authority to other
servers, keeping references to those servers.
• There are several root servers, each covering the whole
domain name space.
• The servers are distributed all around the world.
• DNS defines two types of servers:
➢ primary and secondary.
Primary servers

• A primary server is a server that stores a file about


the zone for which it is an authority.
• It is responsible for
➢ creating,
➢ maintaining, and
➢ updating the zone file.
• It stores the zone file on a local disk.
Secondary server

• A secondary server is a server that


➢ transfers the complete information about a zone
from another server (primary or secondary) and
➢ stores the file on its local disk.
• The secondary server neither creates nor updates the
zone files.
• If updating is required, it must be done by the
primary server, which sends the updated version to
the secondary.
• The primary and secondary servers are both authoritative for the
zones they serve.
➢ Which does not to put the secondary server at a lower level of
authority
➢ but to create redundancy for the data so that if one server
fails, the other can continue serving clients.
• A server can be a primary server for a specific zone and a secondary
server for another zone.
➢ A primary server loads all information from the disk file;
➢ the secondary server loads all information from the primary
server.
➢ When the secondary downloads information from the primary, it
is called zone transfer.
Name resolution

• Process performed by resolver- Name resolution.


• Different navigation/resolution models supported by
DNS
• Iterative
• Recursive
1. Iterative resolution

• Iterative queries:
• When the name server of a host cannot resolve a
query, the name server sends a closest known
authoritative name server referral to the root server
• This involves more work for the resolver.
• The client repeats the same query to multiple
servers.
2. Recursive resolution
Recursive query:
• When the name server of a host
cannot resolve a query,
➢ the server issues a query to
resolve the query to the “closest
known” authoritative name
server.
• When the query is finally resolved,
the response travels back until it
finally reaches the requesting
client. This is called recursive
resolution.
DNS MESSAGES
• DNS has two types of messages: query and response.
Figure : DNS messages
• Both types have the same format.
• The query message consists of
➢ a header and question records;
• the response message consists of
➢a header,
➢question records,
➢answer records,
➢ authoritative records,
➢and additional records. Figure : Query and response messages
Header format
Rest of the DNS Message
• Question Section: Section consisting of one
or more question records. Exists in both
query and response
• Answer Section: Section consisting of one or
more resource records. Exists in response
only. This section includes the answer from
the server to the client (resolver).
• Authoritative Section: Section consisting of
one or more resource records. Exists in
response only. This contains the domain
name about one or more of the authoritative
servers for the query.
• Additional Info Section: Contains one or
more resource records. Exists in response
only. Eg.,IP address of authoritative server.
TYPES OF RECORDS

• Two types of records are used in DNS.


➢ Question Record
➢ Resource Record
• The question records are used in the question section of the
query and response messages. A question record is used by the
client to get information from a server. This contains the
domain name.
• The resource records are used in the answer, authoritative,
and additional information sections of the response message.
Each domain name (each node on the tree) is associated with a
record called the resource record. The server database consists
of resource records. Resource records are also what is returned
by the server to the client.
Electronic mail
• The earliest and the most common application of the Internet
is electronic mail or email.
• Email is a store-and-forward application.
• This means a message can be sent to someone not currently
connected to the Internet.
• The message can remain in the system until the recipient
retrieves it.
• The email application allows a user to send messages over a
private network or the global Internet.
• Email supports:
• ❏ Sending a single message to one or more recipients.
• ❏ Sending messages that include text, voice, video, or
graphics.
• ❏ Organization of message-based criteria such as priority
etc.
• Email can be compared and contrasted with regular
mail, which is often referred to as snail mail.
• Email has several advantages over snail mail:
• ❏ It is faster.
• ❏ It is easier to distribute to a group of recipients.
• ❏ It is less expensive.
• ❏ It can be less time-consuming.
• Disadvantages
• ❏ An email cannot be certified. Although the sender
can check to see if the receiver has received the mail,
it cannot be used as legal proof. If we need a signature
from the recipient, we still need to use the services of
snail mail or some other courier service.

• ❏ The privacy of email is still an open question.


Although several software packages are on the market
to make email confidential, it cannot be guaranteed
unless everyone uses one of these packages.

• ❏ Email messaging is subject to abuse.


Architecture and services
• The sending of electronic mail in the Internet requires these
components: User agents (UAs), mail transfer agents
(MTAs), and the protocol that controls mail delivery
• 1. User agent: A user agent controls the composing, reading,
forwarding, replying, and saving of email messages. The
user agent is not responsible for sending or receiving email.

• 2. Mail Transfer Agent (MTA) The actual mail transfer


requires a mail transfer agent (MTA). To send mail, a system
must have a client MTA, and to receive mail, a system must
have a server MTA. The client MTA is installed on the user’s
computer. The client and the server MTA are installed on a
computer that is used as the mail server.
• 3. Protocols:
• SMTP, IMAP, POP3
Basic email
1. Composition
functions
• Refers to the process of creating messages and answers.
• Although any text editor can be used for the body of the
message, the system itself can provide assistance with
addressing and the numerous header fields attached to each
message.
• For example, when answering a message, the e-mail system
can extract the originator's address from the incoming e-mail
and automatically insert it into the proper place in the reply.
2. Transfer
• Refers to moving messages from the originator to the recipient.
• In large part, this requires establishing a connection to the
destination or some intermediate machine, outputting the
message, and releasing the connection.
• The e-mail system should do this automatically, without
bothering the user.
Basic email functions
3. Reporting
• Has to do with telling the originator what happened to the message.
• Was it delivered? Was it rejected? Was it lost? Numerous applications exist in
which confirmation of delivery is important and may even have legal
significance
4. Displaying
• Displaying incoming messages is needed so people can read their e-mail.
• Sometimes conversion is required or a special viewer must be invoked, for
example, if the message is a PostScript file or digitized voice.
• Simple conversions and formatting are sometimes attempted as well.
5. Disposition
• is the final step and concerns what the recipient does with the message after
receiving it.
• Possibilities include throwing it away before reading, throwing it away after
reading, saving it, and so on.
• It should also be possible to retrieve and reread saved messages, forward
them, or process them in other ways.
Message formats
• RFC 822:

• Messages consist of a primitive envelope (described in


RFC 821), some number of header fields, a blank line,
and then the message body.
• Each header field (logically) consists of a single line of
ASCII text containing the field name, a colon, and, for
most fields, a value.
• The principal header fields related to message transport
are
• The To: field gives the DNS address of the primary
recipient. Having multiple recipients is also allowed.
• The Cc: field gives the addresses of any secondary recipients.
• The term Cc: (Carbon copy) is email addresses of secondary
recipient
• The Bcc: (Blind carbon copy) field is like the Cc: field, except that
this line is deleted from all the copies sent to the primary and
secondary recipients. This feature allows people to send copies to
third parties without the primary and secondary recipients
knowing this.
• The next two fields, From: and Sender: tell who wrote and sent
the message, respectively.
• A line containing Received: is added by each message transfer
agent along the way. The line contains the agent's identity, the
date and time the message was received, and other information
that can be used for finding bugs in the routing system.
• The Return-Path: field is added by the final message transfer
agent and was intended to tell how to get back to the sender.
• MIME

• RFC 822 headers were added by MIME.


• In the early days of the ARPANET, e-mail consisted exclusively of
text messages written in English and expressed in ASCII.
• Nowadays, on the worldwide Internet, this approach is no longer
adequate.
• The problems include sending and receiving
• 1. Messages in languages with accents (e.g., French and German).
• 2. Messages in non-Latin alphabets (e.g., Hebrew and Russian).
• 3. Messages in languages without alphabets (e.g., Chinese and
Japanese).
• 4. Messages not containing text at all (e.g., audio or images).
• A solution was proposed in RFC 1341 and updated in RFCs 2045–
2049. This solution, called
• MIME (Multipurpose Internet Mail Extensions) is now widely used.
MIME HEADERS
• 1. MIME Version : Any message not containing a MIME-Version
header is assumed to be an English plaintext message and is
processed as such.
• 2. The Content-Description : header is an ASCII string telling
what is in the message.
• This header is needed so the recipient will know whether it is
worth decoding and reading the message.
• If the string says: ''Photo of Barbara’s hamster'' and the person
getting the message is not a big hamster fan, the message will
probably be discarded rather than decoded into a high resolution
color photograph.
• 3. The Content-Id : header identifies the content. It uses the
same format as the standard Message-Id: header.
• 4. The Content-Transfer-Encoding : tells how the body is wrapped
for transmission through a network.
• Different schemes (plus an escape to new schemes) are provided.
• ○ The simplest scheme is just ASCII text. ASCII characters use 7 bits
and can be carried
• directly by the e-mail protocol provided that no line exceeds 1000
characters.
• ○ The next simplest scheme is the same thing, but using 8-bit
characters, that is, all values
• from 0 up to and including 255. Messages using the 8-bit encoding
must still adhere to
• the standard maximum line length.
• ○ Binary files need to be “packaged” as text in order to be sent over
the Internet.
• ○ The correct way to encode binary messages is to use base64
encoding to package this
• data for transfer
• BASE64 ENCODING
• ● In this scheme, groups of 24 bits are broken up into four 6-bit
units, with each unit being sent as a legal ASCII character.
• ● The coding is ''A'' for 0, ''B'' for 1, and so on, followed by the
26 lower-case
• letters, the ten digits, and finally + and / for 62 and 63,
respectively.
• ● The == and = sequences indicate that the last group
contained only 8 or 16
• bits, respectively.
• ● Arbitrary binary text can be sent safely using this scheme.
• For messages that are almost entirely ASCII but with a
few non-ASCII
• characters, base64 encoding is somewhat inefficient.
• ● Instead, an encoding known as quoted-printable
encoding is used. This is just 7-bit ASCII, with all the
characters above 127 encoded as an equal sign
• followed by the character's value as two hexadecimal
digits.
• ● In summary, binary data should be sent encoded in
base64 or quoted-printable form.
• 3. Protocol: SMTP(Simple Mail Transfer Protocol)
SNMP
SIMPLE NETWORK MANAGEMENT PROTOCOL

• A large network can often get into various kinds of trouble due
to routers (dropping too many packets), hosts ( going down)
etc.
• One has to keep track of all these occurrence and adapt to
such situations.
• A protocol has been defined.
• Under this scheme all entities in the network belong to 4 class:
• Managed Nodes
• Management Stations
• Management Information (called Object)
• A management protocol
• The managed nodes can be hosts, routers, bridges, printers or
any other device capable of communicating status information to
others.
• To be managed directly by SNMP, a node must be capable of
running am SNMP management process, called SNMP
agent. Network management is done by management stations
by exchanging information with the nodes. These are basically
general purpose computers running special management
software.
• The management stations polls the stations periodically. Since
SNMP uses unreliable service of UDP the polling is essential to
keep in touch with the nodes.
• Often the nodes send a trap message indicating that it is going to
go down. The management stations then periodically checks
(with an increased frequency). This type of polling is called trap
directed polling.
• Often a group of nodes are represented by a single node
which communicates with the management stations. This
type of node is called proxy agent. The proxy agent can
also serve as a security arrangement.
• All the variables in this scheme are called Objects. Each
variable can be referenced by a specific addressing
scheme adopted by this system.
• The entire collection of all objects is called Management
Information Base (MIB). The addressing is hierarchical as
seen in the picture.
• Internet is addressed as [Link].
• All the objects under this domain have this string at
the beginning.
• The information are exchanged in a standard and
vendor-neutral way.
• All the data are represented in Abstract Syntax
Notation 1 (ASN.1).
Message Description
1. Get_Request Request the value for a variable

Returns the value of the variable asked


for
2. Get_Response
Request a variable next to the previous
one
3. Get_Next_Request
4. Set_Request Set the value of an Object.

5. Trap Agent to manager Trap report

6. Get_bulk_request Request a set of variable of same type

Exchange of MIB among Management


stations
7. Inform_Request
WWW

• The World Wide Web (WWW) is a repository of


information linked together from points all over the
world.
• The WWW has a unique combination of flexibility,
portability, and user-friendly features that distinguish
it from other services provided by the Internet.
• The WWW project was initiated by CERN (European
Laboratory for Particle Physics) to create a system to
handle distributed resources necessary for scientific
research.
WWW-ARCHITECTURE

• The WWW today is a distributed client-server service, in


which a client using a browser can access a service using a
server.
• However, the service provided is distributed over many
locations called sites.
• Each site holds one or more documents, referred to as Web pages.
• Each Web page can contain a link to other pages in the same site or at
other sites. The pages can be retrieved and viewed by using browsers.
• The client needs to see some information that it knows belongs to site
A.
• It sends a request through its browser, a program that is designed to
fetch Web documents.
• The request, among other information, includes the address of the site
and the Web page, called the URL, which we will discuss shortly.
• The server at site A finds the document and sends it to the client.
• When the user views the document, she finds some references to
other documents, including a Web page at site B.
• The reference has the URL for the new site.
• The user is also interested in seeing this document. The client sends
another request to the new site, and the new page is retrieved.
1. Client (Browser)

• A variety of vendors offer commercial browsers that interpret and


display a Web document, and all use nearly the same architecture.
• Each browser usually consists of three parts: a controller, client
protocol, and interpreters.
1. The controller receives input from the keyboard or the mouse and
uses the client programs to access the document.
2. After the document has been accessed, the controller uses one of
the interpreters to display the document on the screen.
3. The client protocol can be one of the protocols described
previously.
• Protocols can be anyone such as FTP or the interpreter can be HTML,
Java, or JavaScript, depending on the type of document.

SERVER

• The Web page is stored at the server.


• Each time a client request arrives, the corresponding
document is sent to the client.
• To improve efficiency, servers normally store
requested files in a cache in memory; memory is
faster to access than disk.
• A server can also become more efficient through
multithreading or multiprocessing.
• In this case, a server can answer more than one
request at a time.
Uniform Resource Locator(URL)

• A client that wants to access a Web page needs the


address.
• To facilitate the access of documents distributed
throughout the world, HTTP uses locators.
• The uniform resource locator (URL) is a standard for
specifying any kind of information on the Internet.
• The URL defines four things: protocol, host
computer, port, and path
• EX.
• The protocol is the client/server program used to retrieve the
document. Many different protocols can retrieve a document;
among them are FTP or HTTP. The most common today is HTTP.
• The host is the computer on which the information is located,
although the name of the computer can be an alias. Web pages are
usually stored in computers, and computers are given alias names
that usually begin with the characters "www". This is not
mandatory, however, as the host can be any name given to the
computer that hosts the Web page.
• The URL can optionally contain the port number of the server. If the
port is included, it is inserted between the host and the path, and it
is separated from the host by a colon.
• Path is the pathname of the file where the information is located.
Note that the path can itself contain slashes that, in the UNIX
operating system, separate the directories from the subdirectories
and files.
Cookies
• The World Wide Web was originally designed as a stateless entity. A
client sends a request; a server responds. Their relationship is over.
• The creation and storage of cookies depend on the
implementation; however, the principle is the same.
• 1. When a server receives a request from a client, it stores
information about the client in a file or a string. The information
may include the domain name of the client, the contents of the
cookie (information the server has gathered about the client such
as name, registration number, and so on), a timestamp, and other
information depending on the implementation.
• 2. The server includes the cookie in the response that it sends to
the client.
• 3. When the client receives the response, the browser stores the
cookie in the cookie directory, which is sorted by the domain server
name.
• When a client sends a request to a server, the
browser looks in the cookie directory to see if it can
find a cookie sent by that server.
• If found, the cookie is included in the request.
• When the server receives the request, it knows that
this is an old client, not a new one.
Web documents
• 1. Static pages: Static documents are fixed-content documents
that are created and stored in a server. The client can get only
a copy of the document. In other words, the contents of the
file are determined when the file is created, not when it is
used.
• Created using HTML
• 2. Dynamic pages: A dynamic document is created by a Web
server whenever a browser requests the document.
• When a request arrives, the Web server runs an application
program or a script that creates the dynamic document.
• The server returns the output of the program or script as a
response to the browser that requested the document.
• Ex. Java applets

You might also like