Sunteți pe pagina 1din 7

What is the difference between UDP and TCP internet protocols?

Q. Can you explain the difference between UDP and TCP internet protocol (IP) traffic and its
usage with an example?
A. Transmission Control Protocol (TCP) and User Datagram Protocol (UDP)is a transportation
protocol that is one of the core protocols of the Internet protocol suite. Both TCP and UDP work
at transport layer TCP/IP model and both have very different usage.
Difference between TCP and UDP
TCP UDP
Reliability: TCP is connection- Reliability: UDP is connectionless
oriented protocol. When a file or protocol. When you a send a data or
message send it will get delivered message, you don't know if it'll get
unless connections fails. If connection there, it could get lost on the way.
lost, the server will request the lost There may be corruption while
part. There is no corruption while transferring a message.
transferring a message.
Ordered: If you send two messages Ordered: If you send two messages
along a connection, one after the out, you don't know what order they'll
other, you know the first message will arrive in i.e. no ordered
get there first. You don't have to
worry about data arriving in the
wrong order.
Heavyweight: - when the low level Lightweight: No ordering of
parts of the TCP "stream" arrive in the messages, no tracking connections,
wrong order, resend requests have to etc. It's just fire and forget! This
be sent, and all the out of sequence means it's a lot quicker, and the
parts have to be put back together, so network card / OS have to do very
requires a bit of work to piece little work to translate the data back
together. from the packets.
Streaming: Data is read as a "stream," Datagrams: Packets are sent
with nothing distinguishing where one individually and are guaranteed to be
packet ends and another begins. There whole if they arrive. One packet per
may be multiple packets per read call. one read call.
Examples: World Wide Web (Apache Examples: Domain Name System
TCP port 80), e-mail (SMTP TCP (DNS UDP port 53), streaming media
port 25 Postfix MTA), File Transfer applications such as IPTV or movies,
Protocol (FTP port 21) and Secure Voice over IP (VoIP), Trivial File
Shell (OpenSSH port 22) etc. Transfer Protocol (TFTP) and online
multiplayer games etc

TCP - Transfer Control Protocol.


a.Reliable
b.Connection oriented.
c.Acknowledgement
UDP - User Datagram Protocol.
a.Non Reliable
b.Connectionless
c.No Acknowledgement

User Datagram Protocol (UDP)

It is part of the base protocols of the Internet Protocol Suite. Programs on networked
computers can send short messages sometimes called as datagrams. UDP does not
guarantee any reliability( it happens datagram may arrive out of order, are
duplicated, or are missing without any notice). The fact that no checking whether all
packets are actually delivered is made, UDP proves to be faster and more efficient,
for applications that do not need guaranteed delivery. UDP find its uses in such
situations:

Time-sensitive applications. The problems due to delayed packets are avoided

It is also useful for servers that answer small queries from huge numbers of clients.
UDP supports packet broadcast (conveys to all on local network) and multicasting
(conveys to all subscribers).

Transmission Control Protocol (TCP)

It is often referred to as TCP/IP due to the importance of this protocol in the Internet
Protocol Suite. TCP operates at a higher level, concerned only with the two end
systems, (e.g. between web browser and a web server). TCP provides reliable,
sequential delivery of a stream of data from one program on one computer to
another program on another computer. Common uses of TCP regroup e-mailing
support and file transfer and Web applications. Among its management tasks, TCP
controls message size, the rate at which messages are exchanged, and network
traffic congestion. As for IP, it handles lower-level transmissions from computer to
computer as a message transferred across the Internet.

Note:
IP works by exchanging information chunks called packets. A packet is a sequence
of bytes consisting of a header and a body. The header contains the packet's
destination and path to be taken on the Internet and the body contains the data
which is being transmitted.

- Round-trip time (RTT), also called round-trip delay, is the time required
for a signal pulse or packet to travel from a specific source to a specific destination
and back again. In this context, the source is the computer initiating the signal and
the destination is a remote computer or system that receives the signal and
retransmits it.

Go-Back-N ARQ is a specific instance of the Automatic Repeat-reQuest (ARQ) Protocol, in


which the sending process continues to send a number of frames specified by a window size even
without receiving an ACK packet from the receiver.
The receiver process keeps track of sequence number of the next frame it expects to receive, and
sends that number with every ACK it sends. The receiver will ignore any frame that does not
have the exact sequence number it expects -- whether that frame is a "past" duplicate of a frame
it has already ACK'ed, or whether that frame is a "future" frame past the lost packet it is waiting
for. Once the sender has sent all of the frames in its window, it will detect that all of the frames
since the first lost frame are outstanding, and will go back to sequence number of the last ACK it
received from the receiver process and fill its window starting with that frame and continue the
process over again.

A nice java applet can be found here:

http://media.pearsoncmg.com/aw/aw_kurose_network_2/applets/go-back-n/go-back-n.html
Go-Back-N ARQ
Go-Back-N ARQ is a specific instance of the Automatic Repeat-reQuest (ARQ) Protocol, in
which the sending process continues to send a number of frames specified by a window size even
without receiving an ACK packet from the receiver.
The receiver process keeps track of sequence number of the next frame it expects to receive, and
sends that number with every ACK it sends. The receiver will ignore any frame that does not
have the exact sequence number it expects -- whether that frame is a "past" duplicate of a frame
it has already ACK'ed [1] or whether that frame is a "future" frame past the lost packet it is
waiting for. Once the sender has sent all of the frames in its window, it will detect that all of the
frames since the first lost frame are outstanding, and will go back to sequence number of the last
ACK it received from the receiver process and fill its window starting with that frame and
continue the process over again.
Go-Back-N ARQ is a more efficient use of a connection than Stop-and-wait ARQ, since unlike
waiting for an acknowledgement for each packet, the connection is still being utilized as packets
are being sent. In other words, during the time that would otherwise be spent waiting, more
packets are being sent. However, this method also results in sending frames multiple times -- if
any frame was lost or damaged, or the ACK acknowledging them was lost or damaged, then that
frame and all following frames in the window (even if they were received without error) will be
re-sent. To avoid this, Selective Repeat ARQ can be used. [2]
Contents:
1. Pseudocode
2. Choosing a Window size(N)
3. Examples
4. References
5. External links
1. Pseudocode
These examples assume an infinite amount of sequence and request numbers. [3]
N = windowsize Rn = request number Sn = sequence number Sb = sequence base Sm = sequence
max Receiver: Rn = 0 Do the following forever: If the packet received = Rn && the packet is
error free Accept the packet and send it to a higher layer Rn = Rn +1 Send a Request for Rn Else
Refuse packet Send a Request for Rn Sender: Sb = 0 Sm = N - 1 Repeat the following steps
forever: 1. If you receive a request number where Rn > Sb Sm = Sm + (Rn - Sb) Sb =Rn 2. If no
packet is in transmission, Transmit a packet where Sb <= Sn <= Sm. Packets are transmitted in
order.
2. Choosing a Window size(N)
There are a few things to keep in mind when choosing a value for N.
1. The sender must not transmit too fast. N should be bounded by the receiver’s ability to process
packets.
2. N must be smaller than the number of sequence numbers (if they are numbered from zero to n-
1) to verify transmission in cases of any packet (any data or ACK packet) being dropped. [4]
3. Given the bounds presented in (1) and (2), choose N to be the largest number possible. [5]
What is the difference between flow control and congestion control? Where can I find
more information on this?

>
TCP's four congestion control algorithms include: slow start, congestion avoidance, fast
retransmit, and fast recovery. Congestion control basically states that a network device can
transmit only a certain number of packets and can not add more packets to a network until an
acknowledgement is received. http://www.ecse.rpi.edu/Homepages/shivkuma/research/cong-
papers.html has some good papers on the topic.
Flow control works by refusing new connections until congestion is resolved. In serial
transmissions, Xon/Xoff is used for flow control. It is a handshaking mechanism that will keep a
sender from sending data faster than a receiver can receive it.
Flow control vs. congestion control:

Flow control means preventing the source from sending data that the
sink will end up dropping because it runs out of buffer space.
This is fairly easy with a sliding window protocol--just make sure
the source's window is no larger than the free space in the sink's
buffer. TCP does this by letting the sink advertise its free buffer
space in the window field of the acks.

Congestion control means preventing (or trying to prevent) the


source from sending data that will end up getting dropped by a
router because its queue is full. This is more complicated, because
packets from different sources travelling different paths can
converge on the same queue.
Sh
oul
d
Yo
ur
Em
ail
Liv
What is a e In
the

Subnet Clo
ud
?A
Mask? Co
mp
ara
A subnet mask allows you tive
to identify which part of Co
st
an IP address is reserved An
for the network, and which aly
part is available for host sis
Acc
use. If you look at the IP ordi
address alone, especially ng
now with classless inter- to
Forr
domain routing, you can't est
tell which part of the er,
address is which. Adding "Go
ogl
the subnet mask, or e is
netmask, gives you all the setti
information you need to ng
a
calculate network and host new
portions of the address pric
e
with ease. In summary, floo
knowing the subnet mask r on
can allow you to easily em
ail
calculate whether IP and
addresses are on the same arc
subnet, or not. hivi
ng

subnet
cost
s."
Do

mask wnl
oad
the
Last modified: Tuesday, January 15, 2008
Forr
est
A mask used to determine er
what subnet an IP address rep
ort
belongs to. An IP address co
has two components, the mp
network address and the arin
g
host address. For example, the
consider the IP address cost
150.215.017.009. Assuming this is part of a Class B network, the first two numbers (150.215)semof
represent the Class B network address, and the second two numbers (017.009) identify a ail
particular host on this network. fro
m
Subnetting enables the network administrator to further divide the host part of the address intoGo
two or more subnets. In this case, a part of the host address is reserved to identify the particular ogl
e
subnet. This is easier to see if we show the IP address in binary format. The full address is: and
oth
er
pro
vide
rs.
>>

Clo
10010110.11010111.00010001.00001001
The Class B network part is:
10010110.11010111
and the host address is
00010001.00001001
If this network is divided into 14 subnets, however, then the first 4 bits of the host address (0001)
are reserved for identifying the subnet.
The subnet mask is the network address plus the bits reserved for identifying the subnetwork.
(By convention, the bits for the network address are all set to 1, though it would also work if the
bits were set exactly as in the network address.) In this case, therefore, the subnet mask would be
11111111.11111111.11110000.00000000. It's called a mask because it can be used to identify
the subnet to which an IP address belongs by performing a bitwise AND operation on the mask
and the IP address. The result is the subnetwork address:
Subnet Mask 255.255.240.000 11111111.11111111.11110000.00000000
IP Address 150.215.017.009 10010110.11010111.00010001.00001001
Subnet Address 150.215.016.000 10010110.11010111.00010000.00000000
The subnet address, therefore, is 150.215.016.000.

subnet mask
A mask used to determine what subnet an IP address belongs to. An IP address has two
components, the network address and the host address. For example, consider the IP address
150.215.017.009. Assuming this is part of a Class B network, the first two numbers (150.215)
represent the Class B network address, and the second two numbers (017.009) identify a
particular host on this network.
Subnetting enables the network administrator to further divide the host part of the address into
two or more subnets. In this case, a part of the host address is reserved to identify the particular
subnet. This is easier to see if we show the IP address in binary format. The full address is:
10010110.11010111.00010001.00001001
The Class B network part is:
10010110.11010111
and the host address is
00010001.00001001
If this network is divided into 14 subnets, however, then the first 4 bits of the host address (0001)
are reserved for identifying the subnet.
The subnet mask is the network address plus the bits reserved for identifying the subnetwork.
(By convention, the bits for the network address are all set to 1, though it would also work if the
bits were set exactly as in the network address.) In this case, therefore, the subnet mask would be
11111111.11111111.11110000.00000000. It's called a mask because it can be used to identify
the subnet to which an IP address belongs by performing a bitwise AND operation on the mask
and the IP address. The result is the subnetwork address:
Subnet Mask 255.255.240.000 11111111.11111111.11110000.00000000
IP Address 150.215.017.009 10010110.11010111.00010001.00001001
Subnet Address 150.215.016.000 10010110.11010111.00010000.00000000
The subnet address, therefore, is 150.215.016.000.

S-ar putea să vă placă și