TCPIP_Chapter9UserDatagramProtocol(UDP).

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

TCP/IP协议原理吴凡通信与信息工程学院网络工程系E-mail:wufan@uestc.edu.cnPhone:61830521(O)2020/1/10TCP/IPProtocolSuite2TransportLayerProtocolTransportLayerprotocol:ToserveastheintermediarybetweentheapplicationprogramsandthenetworkoperationsResponsibilitiesTocreateaprocess-to-processcommunicationToprovideacontrolmechanismatthetransportlayerflowcontrol&errorcontrolToprovideaconnectionmechanismfortheprocessesDatastream2ProtocolsfortransportlayerTransmissionControlProtocol,TCPUserDatagramProtocol,UDP2020/1/10TCP/IPProtocolSuite3Chapter9UDPProcess-to-processcommunicationUserdatagramChecksumUDPoperationUseofUDPUDPpackage2020/1/10TCP/IPProtocolSuite4Process-to-ProcessComm.Internet进程Process进程ProcessDomainofIPprotocolDomainoftransportprotocolsIP地址协议端口(port)端点(endpoint)+2020/1/10TCP/IPProtocolSuite5IPentityTransportLayerprotocolentityPortNumbers212000(21)(23)(80)Process1Process2Process3803450236490IPAddress2020/1/10TCP/IPProtocolSuite6Process-to-ProcessCommunicationUDP负责将IP数据报交付给适当的进程Process(进程):arunningapplicationprogramAcomputercanrunseveralprocessesatthesametimeC/SapplicationmodelClient:aprocessonthelocalhostwhichneedsservicesSever:aprocessontheremotehostwhichprovidestheservicesForProcess-to-ProcessCommunication,mustdefinethe:Localhost(IP),localprocess(PortNumber)Remotehost(IP),remoteprocess(PortNumber)2020/1/10TCP/IPProtocolSuite7PortNumbersVS.C/SPortnumber:todefinetheprocessesEphemeralportnumber(短暂端口号):canbechosenrandomlybytheclientprocessWell-knownportnumber(熟知端口号):isuniversalportnumberforserverprocess传输协议Data1352000Data1352000传输协议1352000ClientServer……多目标并发通信Well-knownportsusedwithUDP2020/1/10TCP/IPProtocolSuite82020/1/10TCP/IPProtocolSuite9IPAddress&PortNumber135200113193.14.26.75200113193.14.26.7IPheaderTransportprotocolheaderPortnumber…ServerProcesses21802020/1/10TCP/IPProtocolSuite10IANARangesWell-knownportsAssignedandcontrolledbyIANARegisteredportsNotassignedorcontrolledbyIANACanonlyberegisteredwithIANAtopreventduplicationDynamicportsNeithercontrollednorregisteredCanbeusedbyanyprocess010231024491514915265535Well-knownRegisteredDynamicPortnumber2020/1/10TCP/IPProtocolSuite11Well-knownPortsThewell-knownPortsonmostsystemscanonlybeusedbysystem(orroot)processesorbyprogramsexecutedbyprivilegedusersTotheextentpossible,someportassignmentsarebothusedwiththeTCPandUDPExample:port53(DNS)2020/1/10TCP/IPProtocolSuite12Socket(套接字)Addresses(IPaddress,Portnumber)SocketAddress——todefinetheS/CprocessuniquelyProcess-to-processcommunicationneeds2SocketAddresses客户套接字地址服务器套接字地址2020/1/10TCP/IPProtocolSuite13Chapter9UDPProcess-to-processcommunicationUserdatagramChecksumUDPoperationUseofUDPUDPpackage2020/1/10TCP/IPProtocolSuite14UserDatagramUserDatagramProtocol,UDPRFC768,用户数据报协议IPLANsMANsWANsICMPIGMPARPRARPNetworkLayerNetworkAccessLayerApplicationLayerTCPUDPTransportLayer2020/1/10TCP/IPProtocolSuite15IPheaderIPdataProtocol=17UserDatagramFormatUDPHeaderSourceportnumber16bitsDestinationportnumber16bitsTotallength16bits(0~65535)Checksum16bitsDataThelengthofthedatacanbebetween0and65507bytes65507=65535––IPheaderUDPheader208IPheaderIPdata2020/1/10TCP/IPProtocolSuite16Chapter9UDPProcess-to-processcommunicationUserdatagramChecksumUDPoperationUseofUDPUDPpackage2020/1/10TCP/IPProtocolSuite17ChecksumUDPchecksum与IP校验和的计算方法相同校验内容不同,包括三个部分:Pseudoheader+UDPheader+DataPseudoheader(伪首部)根据IP首部的部分信息形成不会与UDP报文一起发送到网络上进一步确保UDP报文送到正确主机(目的IP地址正确)的正确端口上ChecksumOptional减少高可靠性网络上的传输开销2020/1/10TCP/IPProtocolSuite18PseudoHeaderFormatProtocolAll0sUDPtotallengthDestinationIPaddressSourceIPaddressSourceportnumberDest.portnumberUDPtotallengthChecksumDataPseudoheaderHeader2020/1/10TCP/IPProtocolSuite19Chapter9UDPProcess-to-processcommunicationUserdatagramChecksumUDPoperationUseofUDPUDPpackage2020/1/10TCP/IPProtocolSuite20UDPOperationAconnectionless,unreliabletransportprotocolTocreateaprocess-to-processcommunicationConnectionless:不同路径、不编号、面向报文面向报文:不支持数据流,也不支持分段、重组NoflowcontrolAlittererrorcontrol:checksum出错,悄悄丢弃对IP协议增强主机多目标通信的区分,允许多个通信并发进行而不会发生混淆2020/1/10TCP/IPProtocolSuite21Encapsulation&Decapsulation2020/1/10TCP/IPProtocolSuite22QueuesinUDP队列是与端口相关联在一起的进程入队列/出队列2020/1/10TCP/IPProtocolSuite23Multiplexing&Demultiplexing2020/1/10TCP/IPProtocolSuite24Chapter9UDPProcess-to-processcommunicationUserdatagramChecksumUDPoperationUseofUDPUDPpackage2020/1/10TCP/IPProtocolSuite25UseofUDP简单、简短的应用简单的请求-响应通信,如查询操作(DNS)、网络管理IPphone,利用UDP快捷的特点适用于具有内部流控和差错控制的进程,如TFTP组播或广播应用某些路由协议,如RIP一般使用方式——客户/服务器模式服务端:固定守候在特定portx,提供服务客户端:动态绑定任意portn,向服务器portx发出请求,获得服务响应2020/1/10TCP/IPProtocolSuite26Chapter9UDPProcess-to-processcommunicationUserdatagramChecksumUDPoperationUseofUDPUDPpackage2020/1/10TCP/IPProtocolSuite27UDPPackage2020/1/10TCP/IPProtocolSuite28Discussion伪首部使得IP层和UDP层的界线模糊不清考查UDP协议软件在发送报文时如何计算校验和UDPIPI1NI1NI2NI3I2I317(dIP,dPort,Data)sPort封装UDP计算CS计算CS的困难:计算前需要知道sIP,但在IP选路前,sIP是未知的(sIP与选择的NI有关)计算步骤:1.封装成UDP送给IP层2.IP层完成选路,得到sIP,再送回UDP层3.UDP层计算CS,再送IP层UDP接

1 / 29
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功