Vous êtes sur la page 1sur 6

12/1/2016

UserDatagramProtocolWikipedia

UserDatagramProtocol
FromWikipedia,thefreeencyclopedia

TheUserDatagramProtocol(UDP)isoneofthecoremembersoftheInternetprotocolsuite.Theprotocolwasdesigned
byDavidP.Reedin1980andformallydefinedinRFC768.WithUDP,computerapplicationscansendmessages,inthis
casereferredtoasdatagrams,tootherhostsonanInternetProtocol(IP)network.Priorcommunicationsarenotrequiredto
setuptransmissionchannelsordatapaths.
UDPusesasimpleconnectionlesstransmissionmodelwithaminimumofprotocolmechanism.UDPprovideschecksums
fordataintegrity,andportnumbersforaddressingdifferentfunctionsatthesourceanddestinationofthedatagram.Ithasno
handshakingdialogues,andthusexposestheuser'sprogramtoanyunreliabilityoftheunderlyingnetworkandsothereisno
guaranteeofdelivery,ordering,orduplicateprotection.Iferrorcorrectionfacilitiesareneededatthenetworkinterfacelevel,
anapplicationmayusetheTransmissionControlProtocol(TCP)orStreamControlTransmissionProtocol(SCTP)which
aredesignedforthispurpose.
UDPissuitableforpurposeswhereerrorcheckingandcorrectioniseithernotnecessaryorisperformedintheapplication,
avoidingtheoverheadofsuchprocessingatthenetworkinterfacelevel.TimesensitiveapplicationsoftenuseUDPbecause
droppingpacketsispreferabletowaitingfordelayedpackets,whichmaynotbeanoptioninarealtimesystem.[1]

Contents
1
2
3
4

Attributes
Serviceports
Packetstructure
Checksumcomputation
4.1 IPv4PseudoHeader
4.2 IPv6PseudoHeader
5 Reliabilityandcongestioncontrolsolutions
6 Applications
7 ComparisonofUDPandTCP
8 Seealso
9 Notesandreferences
9.1 Notes
9.2 RFCreferences
10 Externallinks

Attributes
UDPisaminimalmessageorientedtransportlayerprotocolthatisdocumentedinRFC768.UDPprovidesnoguaranteesto
theupperlayerprotocolformessagedeliveryandtheUDPlayerretainsnostateofUDPmessagesoncesent.Forthisreason,
UDPsometimesisreferredtoasUnreliableDatagramProtocol.[2]
AnumberofUDP'sattributesmakeitespeciallysuitedforcertainapplications.
Itistransactionoriented,suitableforsimplequeryresponseprotocolssuchastheDomainNameSystemorthe
NetworkTimeProtocol.
Itprovidesdatagrams,suitableformodelingotherprotocolssuchasinIPtunnelingorRemoteProcedureCallandthe
NetworkFileSystem.
Itissimple,suitableforbootstrappingorotherpurposeswithoutafullprotocolstack,suchastheDHCPandTrivial
FileTransferProtocol.
Itisstateless,suitableforverylargenumbersofclients,suchasinstreamingmediaapplicationsforexampleIPTV

https://en.wikipedia.org/wiki/User_Datagram_Protocol

1/6

12/1/2016

UserDatagramProtocolWikipedia

ThelackofretransmissiondelaysmakesitsuitableforrealtimeapplicationssuchasVoiceoverIP,onlinegames,and
manyprotocolsbuiltontopoftheRealTimeStreamingProtocol.
Workswellinunidirectionalcommunication,suitableforbroadcastinformationsuchasinmanykindsofservice
discoveryandsharedinformationsuchasbroadcasttimeorRoutingInformationProtocol

Serviceports
Applicationsusedatagramsocketstoestablishhosttohostcommunications.Anapplicationbindsasockettoitsendpointof
datatransmission,whichisacombinationofanIPaddressandaserviceport.Aportisasoftwarestructurethatisidentified
bytheportnumber,a16bitintegervalue,allowingforportnumbersbetween0and65535.Port0isreserved,butisa
permissiblesourceportvalueifthesendingprocessdoesnotexpectmessagesinresponse.
UDPprovidesapplicationmultiplexing(viaportnumbers)andintegrityverification(viachecksum)oftheheaderand
payload.[3]Iftransmissionreliabilityisdesired,itmustbeimplementedintheuser'sapplication.
TheInternetAssignedNumbersAuthority(IANA)hasdividedportnumbersintothreeranges.[4]Portnumbers0through
1023areusedforcommon,wellknownservices.OnUnixlikeoperatingsystems,usingoneoftheseportsrequires
superuseroperatingpermission.Portnumbers1024through49151aretheregisteredportsusedforIANAregistered
services.Ports49152through65535aredynamicportsthatarenotofficiallydesignatedforanyspecificservice,andmaybe
usedforanypurpose.Theyalsoareusedasephemeralports,fromwhichsoftwarerunningonthehostmayrandomlychoose
aportinordertodefineitself.[4]Ineffect,theyareusedastemporaryportsprimarilybyclientswhencommunicatingwith
servers.

Packetstructure
UDPHeader
1

Offsets Octet
0
2
3
Octet Bit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
0

Sourceport

Destinationport

32

Length

Checksum

TheUDPheaderconsistsof4fields,eachofwhichis2bytes(16bits).[1]Theuseofthefields"Checksum"and"Source
port"isoptionalinIPv4(pinkbackgroundintable).InIPv6onlythesourceportisoptional(seebelow).
Sourceportnumber
Thisfieldidentifiesthesender'sportwhenmeaningfulandshouldbeassumedtobetheporttoreplytoifneeded.If
notused,thenitshouldbezero.Ifthesourcehostistheclient,theportnumberislikelytobeanephemeralport
number.Ifthesourcehostistheserver,theportnumberislikelytobeawellknownportnumber.[4]
Destinationportnumber
Thisfieldidentifiesthereceiver'sportandisrequired.Similartosourceportnumber,iftheclientisthedestination
hostthentheportnumberwilllikelybeanephemeralportnumberandifthedestinationhostistheserverthentheport
numberwilllikelybeawellknownportnumber.[4]
Length
AfieldthatspecifiesthelengthinbytesoftheUDPheaderandUDPdata.Theminimumlengthis8bytesbecause
thatisthelengthoftheheader.Thefieldsizesetsatheoreticallimitof65,535bytes(8byteheader+65,527bytesof
data)foraUDPdatagram.ThepracticallimitforthedatalengthwhichisimposedbytheunderlyingIPv4protocolis
65,507bytes(65,5358byteUDPheader20byteIPheader).[4]
InIPv6jumbogramsitispossibletohaveUDPpacketsofsizegreaterthan65,535bytes.[5]RFC2675specifiesthat
thelengthfieldissettozeroifthelengthoftheUDPheaderplusUDPdataisgreaterthan65,535.
Checksum
Thechecksumfieldmaybeusedforerrorcheckingoftheheaderanddata.ThisfieldisoptionalinIPv4,and
mandatoryinIPv6.[6]Thefieldcarriesallzerosifunused.[7]
https://en.wikipedia.org/wiki/User_Datagram_Protocol

2/6

12/1/2016

UserDatagramProtocolWikipedia

Checksumcomputation
ThemethodusedtocomputethechecksumisdefinedinRFC768:
Checksumisthe16bitone'scomplementoftheone'scomplementsumofapseudoheaderofinformationfromtheIP
header,theUDPheader,andthedata,paddedwithzerooctetsattheend(ifnecessary)tomakeamultipleoftwo
octets.[7]
Inotherwords,all16bitwordsaresummedusingone'scomplementarithmetic.Addthe16bitvaluesup.Eachtimea
carryout(17thbit)isproduced,swingthatbitaroundandadditbackintotheleastsignificantbit.[8]Thesumisthenone's
complementedtoyieldthevalueoftheUDPchecksumfield.
Ifthechecksumcalculationresultsinthevaluezero(all16bits0)itshouldbesentastheone'scomplement(all1s).
ThedifferencebetweenIPv4andIPv6isinthedatausedtocomputethechecksum.

IPv4PseudoHeader
WhenUDPrunsoverIPv4,thechecksumiscomputedusinga"pseudoheader"[9]thatcontainssomeofthesame
informationfromtherealIPv4header.ThepseudoheaderisnottherealIPv4headerusedtosendanIPpacket,itisused
onlyforthechecksumcalculation.
IPv4PseudoHeaderFormat
1

Offsets Octet
0
2
3
Octet Bit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
0

SourceIPv4Address

32

DestinationIPv4Address

64

12

96

SourcePort

DestinationPort

16

128

Length

Checksum

20

160+

Zeroes

Protocol

UDPLength

Data

ThesourceanddestinationaddressesarethoseintheIPv4header.TheprotocolisthatforUDP(seeListofIPprotocol
numbers):17(0x11).TheUDPlengthfieldisthelengthoftheUDPheaderanddata.Thefielddatastandsforthe
transmitteddata.
UDPchecksumcomputationisoptionalforIPv4.Ifachecksumisnotuseditshouldbesettothevaluezero.

IPv6PseudoHeader
WhenUDPrunsoverIPv6,thechecksumismandatory.ThemethodusedtocomputeitischangedasdocumentedinRFC
2460:
AnytransportorotherupperlayerprotocolthatincludestheaddressesfromtheIPheaderinitschecksum
computationmustbemodifiedforuseoverIPv6toincludethe128bitIPv6addresses.[6]
Whencomputingthechecksum,againapseudoheaderisusedthatmimicstherealIPv6header:

https://en.wikipedia.org/wiki/User_Datagram_Protocol

3/6

12/1/2016

UserDatagramProtocolWikipedia

Offsets Octet

IPv6PseudoHeaderFormat
1

Octet

Bit

32

64

12

96

16

128

20

160

24

192

28

224

32

256

36

288

40

320

SourcePort

DestinationPort

44

352

Length

Checksum

48

384+

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

SourceIPv6Address

DestinationIPv6Address

UDPLength
Zeroes

NextHeader

Data

ThesourceaddressistheoneintheIPv6header.ThedestinationaddressisthefinaldestinationiftheIPv6packetdoesnot
containaRoutingheader,thatwillbethedestinationaddressintheIPv6headerotherwise,attheoriginatingnode,itwillbe
theaddressinthelastelementoftheRoutingheader,and,atthereceivingnode,itwillbethedestinationaddressintheIPv6
header.ThevalueoftheNextHeaderfieldistheprotocolvalueforUDP:17.TheUDPlengthfieldisthelengthoftheUDP
headeranddata.

Reliabilityandcongestioncontrolsolutions
Lackingreliability,UDPapplicationsmustgenerallybewillingtoacceptsomeloss,errorsorduplication.Some
applications,suchasTFTP,mayaddrudimentaryreliabilitymechanismsintotheapplicationlayerasneeded.[4]
Mostoften,UDPapplicationsdonotemployreliabilitymechanismsandmayevenbehinderedbythem.Streamingmedia,
realtimemultiplayergamesandvoiceoverIP(VoIP)areexamplesofapplicationsthatoftenuseUDP.Intheseparticular
applications,lossofpacketsisnotusuallyafatalproblem.Ifanapplicationrequiresahighdegreeofreliability,aprotocol
suchastheTransmissionControlProtocolmaybeusedinstead.
InVoIP,forexample,latencyandjitteraretheprimaryconcerns.TheuseofTCPwouldcausejitterifanypacketswerelost
asTCPdoesnotprovidesubsequentdatatotheapplicationwhileitisrequestingresendingofthemissingdata.Ifusing
UDPtheenduserapplicationsmustprovideanynecessaryhandshakingsuchasrealtimeconfirmationthatthemessagehas
beenreceived.

Applications
NumerouskeyInternetapplicationsuseUDP,including:theDomainNameSystem(DNS),wherequeriesmustbefastand
onlyconsistofasinglerequestfollowedbyasinglereplypacket,theSimpleNetworkManagementProtocol(SNMP),the
RoutingInformationProtocol(RIP)[1]andtheDynamicHostConfigurationProtocol(DHCP).
VoiceandvideotrafficisgenerallytransmittedusingUDP.Realtimevideoandaudiostreamingprotocolsaredesignedto
handleoccasionallostpackets,soonlyslightdegradationinqualityoccurs,ratherthanlargedelaysiflostpacketswere
retransmitted.BecausebothTCPandUDPrunoverthesamenetwork,manybusinessesarefindingthatarecentincreasein
UDPtrafficfromtheserealtimeapplicationsishinderingtheperformanceofapplicationsusingTCP,suchaspointofsale,

https://en.wikipedia.org/wiki/User_Datagram_Protocol

4/6

12/1/2016

UserDatagramProtocolWikipedia

accounting,anddatabasesystems.WhenTCPdetectspacketloss,itwillthrottlebackitsdatarateusage.Sincebothreal
timeandbusinessapplicationsareimportanttobusinesses,developingqualityofservicesolutionsisseenascrucialby
some.[10]
SomeVPNsystemssuchasOpenVPNmayuseUDPwhileimplementingreliableconnectionsanderrorcheckingatthe
applicationlevel.

ComparisonofUDPandTCP
TransmissionControlProtocolisaconnectionorientedprotocol,whichmeansthatitrequireshandshakingtosetupendto
endcommunications.Onceaconnectionissetup,userdatamaybesentbidirectionallyovertheconnection.
ReliableStrictlyonlyattransportlayer,TCPmanagesmessageacknowledgment,retransmissionandtimeout.
Multipleattemptstodeliverthemessagearemade.Ifitgetslostalongtheway,theserverwillrerequestthelostpart.
InTCP,there'seithernomissingdata,or,incaseofmultipletimeouts,theconnectionisdropped.(Thisreliability
howeverdoesnotcoverapplicationlayer,atwhichaseparateacknowledgementflowcontrolisstillnecessary)
OrderedIftwomessagesaresentoveraconnectioninsequence,thefirstmessagewillreachthereceiving
applicationfirst.Whendatasegmentsarriveinthewrongorder,TCPbuffersdelaytheoutoforderdatauntilalldata
canbeproperlyreorderedanddeliveredtotheapplication.
HeavyweightTCPrequiresthreepacketstosetupasocketconnection,beforeanyuserdatacanbesent.TCP
handlesreliabilityandcongestioncontrol.
StreamingDataisreadasabytestream,nodistinguishingindicationsaretransmittedtosignalmessage(segment)
boundaries.
UserDatagramProtocolisasimplermessagebasedconnectionlessprotocol.Connectionlessprotocolsdonotsetupa
dedicatedendtoendconnection.Communicationisachievedbytransmittinginformationinonedirectionfromsourceto
destinationwithoutverifyingthereadinessorstateofthereceiver.
UnreliableWhenaUDPmessageissent,itcannotbeknownifitwillreachitsdestinationitcouldgetlostalongthe
way.Thereisnoconceptofacknowledgment,retransmission,ortimeout.
NotorderedIftwomessagesaresenttothesamerecipient,theorderinwhichtheyarrivecannotbepredicted.
LightweightThereisnoorderingofmessages,notrackingconnections,etc.Itisasmalltransportlayerdesignedon
topofIP.
DatagramsPacketsaresentindividuallyandarecheckedforintegrityonlyiftheyarrive.Packetshavedefinite
boundarieswhicharehonoreduponreceipt,meaningareadoperationatthereceiversocketwillyieldanentire
messageasitwasoriginallysent.
NocongestioncontrolUDPitselfdoesnotavoidcongestion.Congestioncontrolmeasuresmustbeimplementedat
theapplicationlevel.
Broadcastsbeingconnectionless,UDPcanbroadcastsentpacketscanbeaddressedtobereceivablebyalldevices
onthesubnet.

Seealso
ListofTCPandUDPportnumbers
ReliableUserDatagramProtocol(RUDP)
Comparisonoftransportlayerprotocols
UDPfloodattack
UDPDataTransport
UDPLiteavariantthatwilldeliverpacketseveniftheyaremalformed
UDPHelperAddress
MicroTransportProtocol(TP)

Notesandreferences
https://en.wikipedia.org/wiki/User_Datagram_Protocol

5/6

12/1/2016

UserDatagramProtocolWikipedia

Notes
1.Kurose,J.F.Ross,K.W.(2010).ComputerNetworking:ATopDownApproach(5thed.).Boston,MA:PearsonEducation.
ISBN9780131365483.
2.content@ipv6.com."UDPProtocolOverview".Ipv6.com.Retrieved17August2011.
3.Clark,M.P.(2003).DataNetworksIPandtheInternet,1sted.WestSussex,England:JohnWiley&SonsLtd.
4.Forouzan,B.A.(2000).TCP/IP:ProtocolSuite,1sted.NewDelhi,India:TataMcGrawHillPublishingCompanyLimited.
5.RFC2675
6."DeeringS.&HindenR.(December1998).RFC2460:InternetProtocol,Version6(IPv6)Specification.InternetEngineeringTask
Force.".
7."Postel,J.(August1980).RFC768:UserDatagramProtocol.InternetEngineeringTaskForce".
8."Compute16bitOne'sComplementSum".http://mathforum.org/.John.20020320.Retrieved20141105.Externallinkin
|website=(help)
9.RFC768,p2
10."TheimpactofUDPonDataApplications".Networkperformancedaily.com.Retrieved17August2011.

RFCreferences
RFC768UserDatagramProtocol
RFC2460InternetProtocol,Version6(IPv6)Specification
RFC2675IPv6Jumbograms
RFC4113ManagementInformationBasefortheUDP
RFC5405UnicastUDPUsageGuidelinesforApplicationDesigners

Externallinks
IANAPortAssignments(http://www.iana.org/assignments/portnumbers)
Wikiversityhaslearning
TheTroublewithUDPScanning(PDF)(http://condor.depaul.edu/~jkristof/pap
materialsaboutUser
ers/udpscanning.pdf)
DatagramProtocol
BreakdownofUDPframe(http://www.networksorcery.com/enp/protocol/udp.h
tm)
UDPonMSDNMagazineSocketsandWCF(http://msdn.microsoft.com/enus/magazine/cc163648.aspx)
UDPconnections(http://www.faqs.org/docs/iptables/udpconnections.html)
Retrievedfrom"https://en.wikipedia.org/w/index.php?title=User_Datagram_Protocol&oldid=746671612"
Categories: Internetprotocols InternetStandards Transportlayerprotocols
Thispagewaslastmodifiedon28October2016,at20:40.
TextisavailableundertheCreativeCommonsAttributionShareAlikeLicenseadditionaltermsmayapply.Byusing
thissite,youagreetotheTermsofUseandPrivacyPolicy.WikipediaisaregisteredtrademarkoftheWikimedia
Foundation,Inc.,anonprofitorganization.

https://en.wikipedia.org/wiki/User_Datagram_Protocol

6/6

Vous aimerez peut-être aussi