欢迎来到天天文库
浏览记录
ID:21325753
大小:113.32 KB
页数:5页
时间:2018-10-21
《tcp及udp区别》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、TCP与UDP区别TCP---传输控制协议,提供的是面向连接、可靠的字节流服务。当客户和服务器彼此交换数据前,必须先在双方之间建立一个TCP连接,之后才能传输数据。TCP提供超时重发,丢弃重复数据,检验数据,流量控制等功能,保证数据能从一端传到另一端。UDP---用户数据报协议,是一个简单的面向数据报的运输层协议。UDP不提供可靠性,它只是把应用程序传给IP层的数据报发送出去,但是并不能保证它们能到达目的地。由于UDP在传输数据报前不用在客户和服务器之间建立一个连接,且没有超时重发等机制,故而传输速度很快
2、OverviewTCP(TransmissionControlProtocol)isthemostcommonlyusedprotocolontheInternet.ThereasonforthisisbecauseTCPofferserrorcorrection.WhentheTCPprotocolisusedthereisa"guaranteeddelivery."Thisisduelargelyinparttoamethodcalled"flowcontrol."Flowcontroldetermi
3、neswhendataneedstobere-sent,andstopstheflowofdatauntilpreviouspacketsaresuccessfullytransferred.Thisworksbecauseifapacketofdataissent,acollisionmayoccur.Whenthishappens,theclientre-requeststhepacketfromtheserveruntilthewholepacketiscompleteandisidenticalt
4、oitsoriginal.UDP(UserDatagramProtocol)isanthercommonlyusedprotocolontheInternet.However,UDPisneverusedtosendimportantdatasuchaswebpages,databaseinformation,etc;UDPiscommonlyusedforstreamingaudioandvideo.StreamingmediasuchasWindowsMediaaudiofiles(.WMA),Rea
5、lPlayer(.RM),andothersuseUDPbecauseitoffersspeed!ThereasonUDPisfasterthanTCPisbecausethereisnoformofflowcontrolorerrorcorrection.ThedatasentovertheInternetisaffectedbycollisions,anderrorswillbepresent.RememberthatUDPisonlyconcernedwithspeed.Thisisthemainr
6、easonwhystreamingmediaisnothighquality.Onthecontrary,UDPhasbeenimplementedamongsometrojanhorseviruses.HackersdevelopscriptsandtrojanstorunoverUDPinordertomasktheiractivities.UDPpacketsarealsousedinDoS(DenialofService)attacks.Itisimportanttoknowthedifferen
7、cebetweenTCPport80andUDPport80.Ifyoudon'tknowwhatportsaregohere.FrameStructureAsdatamovesalonganetwork,variousattributesareaddedtothefiletocreateaframe.Thisprocessiscalledencapsulation.Therearedifferentmethodsofencapsulationdependingonwhichprotocolandtopo
8、logyarebeingused.Asaresult,theframestructureofthesepacketsdifferaswell.TheimagesbelowshowboththeTCPandUDPframestructures.TCPFRAMESTRUCTUREUDPFRAMESTRUCTUREThepayloadfieldcontainstheactuallydata.NoticethatTCPhasamore
此文档下载收益归作者所有