分布式计算原理与应用(Distributed-Computing)第四章课件_第1页
分布式计算原理与应用(Distributed-Computing)第四章课件_第2页
分布式计算原理与应用(Distributed-Computing)第四章课件_第3页
分布式计算原理与应用(Distributed-Computing)第四章课件_第4页
分布式计算原理与应用(Distributed-Computing)第四章课件_第5页
已阅读5页,还剩81页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

TheSocketAPIMei-LingLiu12/3/20221DistributedComputing,M.L.LiuTheSocketAPIMei-LingLiu11/3IntroductionThesocketAPIisanInterprocessingCommunication(IPC)programminginterfaceoriginallyprovidedaspartoftheBerkeleyUNIXoperatingsystem.Ithasbeenportedtoallmodernoperatingsystems,includingSunSolarisandWindowssystems.ItisadefactostandardforprogrammingIPC,andisthebasisofmoresophisticatedIPCinterfacesuchasremoteprocedurecallandremotemethodinvocation.12/3/20222DistributedComputing,M.L.LiuIntroductionThesocketAPIisTheconceptualmodelofthesocketAPI

12/3/20223DistributedComputing,M.L.LiuTheconceptualmodelofthesoThesocketAPIAsocketAPIprovidesaprogrammingconstructtermedasocket.Aprocesswishingtocommunicatewithanotherprocessmustcreateaninstance,orinstantiate,suchaconstructThetwoprocessesthenissuesoperationsprovidedbytheAPItosendandreceivedata.12/3/20224DistributedComputing,M.L.LiuThesocketAPIAsocketAPIproConnection-oriented&connectionlessdatagramsocketAsocketprogrammingconstructcanmakeuseofeithertheUDPorTCPprotocol.SocketsthatuseUDPfortransportareknownasdatagramsockets,whilesocketsthatuseTCParetermedstreamsockets.Becauseofitsrelativesimplicity,wewillfirstlookatdatagramsockets,returningtostreamsocketsafterwehaveintroducedtheclient-servermodelinChapter5.12/3/20225DistributedComputing,M.L.LiuConnection-oriented&connectiConnection-oriented&connectionlessdatagramsocket

Datagramsocketscansupportbothconnectionlessandconnection-orientedcommunicationattheapplicationlayer.Thisissobecauseeventhoughdatagramsaresentorreceivedwithoutthenotionofconnectionsatthetransportlayer,theruntimesupportofthesocketAPIcancreateandmaintainlogicalconnectionsfordatagramsexchangedbetweentwoprocesses,asyouwillseeinthenextsection.(TheruntimesupportofanAPIisasetofsoftwarethatisboundtotheprogramduringexecutioninsupportoftheAPI.)12/3/20226DistributedComputing,M.L.LiuConnection-oriented&connectiConnection-oriented&connectionlessdatagramsocket12/3/20227DistributedComputing,M.L.LiuConnection-oriented&connectiTheJavaDatagramSocketAPI InJava,twoclassesareprovidedforthedatagramsocketAPI:theDatagramSocketclassforthesockets.theDatagramPacketclassforthedatagramexchanged. AprocesswishingtosendorreceivedatausingthisAPImustinstantiateaDatagramSocketobject,orasocketinshort.Eachsocketissaidtobe

boundtoaUDPportofthemachinelocaltotheprocess

12/3/20228DistributedComputing,M.L.LiuTheJavaDatagramSocketAPI ITheJavaDatagramSocketAPITosendadatagramtoanotherprocess,aprocess:createsanobjectthatrepresentsthedatagramitself.ThisobjectcanbecreatedbyinstantiatingaDatagramPacketobjectwhichcarries(i)thepayloaddataasareferencetoabytearray,and(ii)thedestinationaddress(thehostIDandportnumbertowhichthereceiver’ssocketisbound.issuesacalltoasendmethodintheDatagramSocketobject,specifyingareferencetotheDatagramPacketobjectasanargument12/3/20229DistributedComputing,M.L.LiuTheJavaDatagramSocketAPIToTheJavaDatagramSocketAPIInthereceivingprocess,aDatagramSocketobjectmustalsobeinstantiatedandboundtoalocalport,theportnumbermustagreewiththatspecifiedinthedatagrampacketofthesender.Toreceivedatagramssenttothesocket,theprocesscreatesadatagramPacketobjectwhichreferencesabytearrayandcallsareceivemethodinitsDatagramSocketobject,specifyingasargumentareferencetotheDatagramPacketobject.12/3/202210DistributedComputing,M.L.LiuTheJavaDatagramSocketAPIITheDataStructuresinthesenderandreceiverprograms12/3/202211DistributedComputing,M.L.LiuTheDataStructuresinthesenTheprogramflowinthesenderandreceiverprograms12/3/202212DistributedComputing,M.L.LiuTheprogramflowinthesenderEventsynchronizationwiththeconnectionlssdatagramsocketsAPI12/3/202213DistributedComputing,M.L.LiuEventsynchronizationwiththeSettingtimeout Toavoidindefiniteblocking,atimeoutcanbesetwithasocketobject:voidsetSoTimeout(int

timeout)

Setatimeoutfortheblockingreceivefromthissocket,inmilliseconds. Onceset,thetimeoutwillbeineffectforallblockingoperations.

12/3/202214DistributedComputing,M.L.LiuSettingtimeout ToavoidindefKeyMethodsandConstructors12/3/202215DistributedComputing,M.L.LiuKeyMethodsandConstructors11Thecoding12/3/202216DistributedComputing,M.L.LiuThecoding11/30/202216DistribConnectionlesssockets Withconnectionlesssockets,itispossibleformultipleprocessestosimultaneouslysenddatagramstothesamesocketestablishedbyareceivingprocess,inwhichcasetheorderofthearrivalofthesemessageswillbeunpredictable,inaccordancewiththeUDPprotocol

12/3/202217DistributedComputing,M.L.LiuConnectionlesssockets WithcoCodesamplesExample1Sender.java,ExampleReceiver.javaMyDatagramSocket.java,Example2SenderReceiver.java,Example2ReceiverSender.java

12/3/202218DistributedComputing,M.L.LiuCodesamplesExample1Sender.javConnection-oriented

datagramsocketAPI Itisuncommontoemploydatagramsocketsforconnection-orientedcommunication;theconnectionprovidedbythisAPIisrudimentaryandtypicallyinsufficientforapplicationsthatrequireatrueconnection.Stream-modesockets,whichwillbeintroducedlater,aremoretypicalandmoreappropriateforconnection-orientedcommunication.

12/3/202219DistributedComputing,M.L.LiuConnection-oriented

datagramMethodscallsforconnection-orienteddatagramsocketAconnectionismadeforasocketwitharemotesocket.Onceasocketisconnected,itcanonlyexchangedatawiththeremotesocket.Ifadatagramspecifyinganotheraddressissentusingthesocket,anIllegalArgumentExceptionwilloccur.Ifadatagramfromanothersocketissenttothissocket,Thedatawillbeignored.12/3/202220DistributedComputing,M.L.LiuMethodscallsforconnection-oConnection-orientedDatagram

Socket Theconnectionisunilateral,thatis,itisenforcedonlyononeside.Thesocketontheothersideisfreetosendandreceivedatatoandfromothersockets,unlessittoocommitstoaconnectiontotheothersocket.SeeExample3Sender,Example3Receiver.12/3/202221DistributedComputing,M.L.LiuConnection-orientedDatagramSTheStream-modeSocketAPIThedatagramsocketAPIsupportstheexchangeofdiscreteunitsofdata(thatis,datagrams).thestreamsocketAPIprovidesamodelofdatatransferbasedonthestream-modeI/OoftheUnixoperatingsystems.Bydefinition,astream-modesocketsupportsconnection-orientedcommunicationonly.12/3/202222DistributedComputing,M.L.LiuTheStream-modeSocketAPITheStream-modeSocketAPI

(connection-orientedsocketAPI)12/3/202223DistributedComputing,M.L.LiuStream-modeSocketAPI

(connecStream-modeSocketAPIAstream-modesocketisestablishedfordataexchangebetweentwospecificprocesses.Datastreamiswrittentothesocketatoneend,andreadfromtheotherend.Astreamsocketcannotbeusedtocommunicatewithmorethanoneprocess.12/3/202224DistributedComputing,M.L.LiuStream-modeSocketAPIAstreamStream-modeSocketAPI InJava,thestream-modesocketAPIisprovidedwithtwoclasses:Serversocket:foracceptingconnections;wewillcallanobjectofthisclassaconnectionsocket.Socket:fordataexchange;wewillcallanobjectofthisclassadatasocket.12/3/202225DistributedComputing,M.L.LiuStream-modeSocketAPI InJavaStream-modeSocketAPIprogramflow12/3/202226DistributedComputing,M.L.LiuStream-modeSocketAPIprogramTheserver(theconnectionlistener)12/3/202227DistributedComputing,M.L.LiuTheserver(theconnectionlisKeymethodsintheServerSocketclassNote:Acceptisablockingoperation.12/3/202228DistributedComputing,M.L.LiuKeymethodsintheServerSockeKeymethodsintheSocketclassAreadoperationontheInputStreamisblocking.Awriteoperationisnonblocking.12/3/202229DistributedComputing,M.L.LiuKeymethodsintheSocketclasConnection-orientedsocketAPI-312/3/202230DistributedComputing,M.L.LiuConnection-orientedsocketAPIConnection-orientedsocketAPI-312/3/202231DistributedComputing,M.L.LiuConnection-orientedsocketAPIConnectionlesssocketAPI12/3/202232DistributedComputing,M.L.LiuConnectionlesssocketAPI11/30Example4EventDiagram12/3/202233DistributedComputing,M.L.LiuExample4EventDiagram11/30/2Example412/3/202234DistributedComputing,M.L.LiuExample411/30/202234DistributeSecureSockets

/products/jsse/Securesocketsperformencryptiononthedatatransmitted.TheJavaTMSecureSocketExtension(JSSE)isaJavapackagethatenablessecureInternetcommunications.ItimplementsaJavaversionofSSL(SecureSocketsLayer)andTLS(TransportLayerSecurity)protocolsItincludesfunctionalitiesfordataencryption,serverauthentication,messageintegrity,andoptionalclientauthentication.UsingJSSE,developerscanprovideforthesecurepassageofdatabetweenaclientandaserverrunninganyapplicationprotocol.12/3/202235DistributedComputing,M.L.LiuSecureSockets

http://java.sunTheJavaSecureSocketExtensionAPI

/products/jsse/doc/apidoc/index.htmlImport.ssl;ClassSSLServerSocketisasubclassofServerSocket,andinheritsallitsmethods.ClassSSLSocketisasubclassofSocket,andinheritsallitsmethods.TherearealsoclassesforCertificationHandshakingKeyManagerSSLsession12/3/202236DistributedComputing,M.L.LiuTheJavaSecureSocketExtensiSummaryInthischapter,weintroducedthesocketapplicationprograminterfaceforinterprocesscommunication.ThesocketAPIiswidelyavailableasaprogrammingfacilityforIPCatarelativelylowlevelofabstraction.12/3/202237DistributedComputing,M.L.LiuSummaryInthischapter,weintSummary-2UsingtheJavasocketAPIs,weintroducedtwotypesofsockets:Thedatagramsockets,whichusestheUserDatagramProtocol(UDP)atthetransportlayertoprovidethesendingandreceivingofdiscretedatapacketsknownasdatagrams.Thestream-modesocket,whichusestheTranportLayerProtocol(TCP)atthetransportlayertoprovidethesendingandreceivingofdatausingadatastream.12/3/202238DistributedComputing,M.L.LiuSummary-2UsingtheJavasockSummary-3KeypointsoftheJavadatagramsocketAPI:Itsupportsbothconnectionlesscommunicationandconnection-orientedcommunication.EachprocessmustcreateaDatagramSocketobjecttosend/receivedatagrams.EachdatagramisencapsulatedinaDatagramPacketobject.12/3/202239DistributedComputing,M.L.LiuSummary-3KeypointsoftheJSummary-4KeypointsoftheJavadatagramsocketAPIcontinued:Inconnectionlesscommunication,adatagramsocketcanbeusedtosendtoorreceivefromanyotherdatagramsocket;inconnection-orientedcommunication,adatagramsocketcanonlybeusedtosendtoorreceivefromthedatagramsocketattachedtotheotherendoftheconnection.Dataforadatagramareplacedinabytearray;ifabytearrayofinsufficientlengthisprovidedbyareceiver,thedatareceivedwillbetruncated.Thereceiveoperationisblocking;thesendoperationisnon-blocking.12/3/202240DistributedComputing,M.L.LiuSummary-4KeypointsoftheJSummary-5KeypointsoftheJavastream-modesocketAPI:Itsupportsconnection-orientedcommunicationonly.Aprocessplaystheroleofconnection-acceptor,andcreatesaconnectionsocketusingtheServerSocketclass.Itthenacceptsconnectionrequestsfromotherprocesses.Aprocess(aconnection-requestor)createsadatasocketusingtheSocketclass,theconstructorofwhichissuesaconnectionrequesttotheconnection-acceptor.12/3/202241DistributedComputing,M.L.LiuSummary-5KeypointsoftheJSummary-6MorekeypointsoftheJavastream-modesocketAPI:Whenaconnectionrequestisgranted,theconnection-acceptorcreatesadatasocket,oftheSocketclass,tosendandreceivedatato/fromtheconnection-requestor.Theconnection-requestorcanalsosendand/orreceivedatato/fromtheconnection-acceptorusingitsdatasocket.Thereceive(read),theconnection-acceptoperation,andtheconnection-requestoperationsareblocking;thesend(write)operationisnon-blocking.Thereadingandwritingofdataintothesocketofdatastreamaredecoupled:theycanbeperformedindifferentdataunits.SeeFigure8.12/3/202242DistributedComputing,M.L.LiuSummary-6MorekeypointsofSummary-7Keypointsofsecuresockets:SecuresocketAPIsareavailablefortransmissionofconfidentialdata.WellknownsecuresocketAPIsincludetheSecureSocketLayer(SSL)andJava’sSecureSocketExtension(JSSE).SecuresocketAPIshavemethodsthataresimilartotheconnection-orientedsocketAPIs.12/3/202243DistributedComputing,M.L.LiuSummary-7KeypointsofsecurTheSocketAPIMei-LingLiu12/3/202244DistributedComputing,M.L.LiuTheSocketAPIMei-LingLiu11/3IntroductionThesocketAPIisanInterprocessingCommunication(IPC)programminginterfaceoriginallyprovidedaspartoftheBerkeleyUNIXoperatingsystem.Ithasbeenportedtoallmodernoperatingsystems,includingSunSolarisandWindowssystems.ItisadefactostandardforprogrammingIPC,andisthebasisofmoresophisticatedIPCinterfacesuchasremoteprocedurecallandremotemethodinvocation.12/3/202245DistributedComputing,M.L.LiuIntroductionThesocketAPIisTheconceptualmodelofthesocketAPI

12/3/202246DistributedComputing,M.L.LiuTheconceptualmodelofthesoThesocketAPIAsocketAPIprovidesaprogrammingconstructtermedasocket.Aprocesswishingtocommunicatewithanotherprocessmustcreateaninstance,orinstantiate,suchaconstructThetwoprocessesthenissuesoperationsprovidedbytheAPItosendandreceivedata.12/3/202247DistributedComputing,M.L.LiuThesocketAPIAsocketAPIproConnection-oriented&connectionlessdatagramsocketAsocketprogrammingconstructcanmakeuseofeithertheUDPorTCPprotocol.SocketsthatuseUDPfortransportareknownasdatagramsockets,whilesocketsthatuseTCParetermedstreamsockets.Becauseofitsrelativesimplicity,wewillfirstlookatdatagramsockets,returningtostreamsocketsafterwehaveintroducedtheclient-servermodelinChapter5.12/3/202248DistributedComputing,M.L.LiuConnection-oriented&connectiConnection-oriented&connectionlessdatagramsocket

Datagramsocketscansupportbothconnectionlessandconnection-orientedcommunicationattheapplicationlayer.Thisissobecauseeventhoughdatagramsaresentorreceivedwithoutthenotionofconnectionsatthetransportlayer,theruntimesupportofthesocketAPIcancreateandmaintainlogicalconnectionsfordatagramsexchangedbetweentwoprocesses,asyouwillseeinthenextsection.(TheruntimesupportofanAPIisasetofsoftwarethatisboundtotheprogramduringexecutioninsupportoftheAPI.)12/3/202249DistributedComputing,M.L.LiuConnection-oriented&connectiConnection-oriented&connectionlessdatagramsocket12/3/202250DistributedComputing,M.L.LiuConnection-oriented&connectiTheJavaDatagramSocketAPI InJava,twoclassesareprovidedforthedatagramsocketAPI:theDatagramSocketclassforthesockets.theDatagramPacketclassforthedatagramexchanged. AprocesswishingtosendorreceivedatausingthisAPImustinstantiateaDatagramSocketobject,orasocketinshort.Eachsocketissaidtobe

boundtoaUDPportofthemachinelocaltotheprocess

12/3/202251DistributedComputing,M.L.LiuTheJavaDatagramSocketAPI ITheJavaDatagramSocketAPITosendadatagramtoanotherprocess,aprocess:createsanobjectthatrepresentsthedatagramitself.ThisobjectcanbecreatedbyinstantiatingaDatagramPacketobjectwhichcarries(i)thepayloaddataasareferencetoabytearray,and(ii)thedestinationaddress(thehostIDandportnumbertowhichthereceiver’ssocketisbound.issuesacalltoasendmethodintheDatagramSocketobject,specifyingareferencetotheDatagramPacketobjectasanargument12/3/202252DistributedComputing,M.L.LiuTheJavaDatagramSocketAPIToTheJavaDatagramSocketAPIInthereceivingprocess,aDatagramSocketobjectmustalsobeinstantiatedandboundtoalocalport,theportnumbermustagreewiththatspecifiedinthedatagrampacketofthesender.Toreceivedatagramssenttothesocket,theprocesscreatesadatagramPacketobjectwhichreferencesabytearrayandcallsareceivemethodinitsDatagramSocketobject,specifyingasargumentareferencetotheDatagramPacketobject.12/3/202253DistributedComputing,M.L.LiuTheJavaDatagramSocketAPIITheDataStructuresinthesenderandreceiverprograms12/3/202254DistributedComputing,M.L.LiuTheDataStructuresinthesenTheprogramflowinthesenderandreceiverprograms12/3/202255DistributedComputing,M.L.LiuTheprogramflowinthesenderEventsynchronizationwiththeconnectionlssdatagramsocketsAPI12/3/202256DistributedComputing,M.L.LiuEventsynchronizationwiththeSettingtimeout Toavoidindefiniteblocking,atimeoutcanbesetwithasocketobject:voidsetSoTimeout(int

timeout)

Setatimeoutfortheblockingreceivefromthissocket,inmilliseconds. Onceset,thetimeoutwillbeineffectforallblockingoperations.

12/3/202257DistributedComputing,M.L.LiuSettingtimeout ToavoidindefKeyMethodsandConstructors12/3/202258DistributedComputing,M.L.LiuKeyMethodsandConstructors11Thecoding12/3/202259DistributedComputing,M.L.LiuThecoding11/30/202216DistribConnectionlesssockets Withconnectionlesssockets,itispossibleformultipleprocessestosimultaneouslysenddatagramstothesamesocketestablishedbyareceivingprocess,inwhichcasetheorderofthearrivalofthesemessageswillbeunpredictable,inaccordancewiththeUDPprotocol

12/3/202260DistributedComputing,M.L.LiuConnectionlesssockets WithcoCodesamplesExample1Sender.java,ExampleReceiver.javaMyDatagramSocket.java,Example2SenderReceiver.java,Example2ReceiverSender.java

12/3/202261DistributedComputing,M.L.LiuCodesamplesExample1Sender.javConnection-oriented

datagramsocketAPI Itisuncommontoemploydatagramsocketsforconnection-orientedcommunication;theconnectionprovidedbythisAPIisrudimentaryandtypicallyinsufficientforapplicationsthatrequireatrueconnection.Stream-modesockets,whichwillbeintroducedlater,aremoretypicalandmoreappropriateforconnection-orientedcommunication.

12/3/202262DistributedComputing,M.L.LiuConnection-oriented

datagramMethodscallsforconnection-orienteddatagramsocketAconnectionismadeforasocketwitharemotesocket.Onceasocketisconnected,itcanonlyexchangedatawiththeremotesocket.Ifadatagramspecifyinganotheraddressissentusingthesocket,anIllegalArgumentExceptionwilloccur.Ifadatagramfromanothersocketissenttothissocket,Thedatawillbeignored.12/3/202263DistributedComputing,M.L.LiuMethodscallsforconnection-oConnection-orientedDatagram

Socket Theconnectionisunilateral,thatis,itisenforcedonlyononeside.Thesocketontheothersideisfreetosendandreceivedatatoandfromothersockets,unlessittoocommitstoaconnectiontotheothersocket.SeeExample3Sender,Example3Receiver.12/3/202264DistributedComputing,M.L.LiuConnection-orientedDatagramSTheStream-modeSocketAPIThedatagramsocketAPIsupportstheexchangeofdiscreteunitsofdata(thatis,datagrams).thestreamsocketAPIprovidesamodelofdatatransferbasedonthestream-modeI/OoftheUnixoperatingsystems.Bydefinition,astream-modesocketsupportsconnection-orientedcommunicationonly.12/3/202265DistributedComputing,M.L.LiuTheStream-modeSocketAPITheStream-modeSocketAPI

(connection-orientedsocketAPI)12/3/202266DistributedComputing,M.L.LiuStream-modeSocketAPI

(connecStream-modeSocketAPIAstream-modesocketisestablishedfordataexchangebetweentwospecificprocesses.Datastreamiswrittentothesocketatoneend,andreadfromtheotherend.Astreamsocketcannotbeusedtocommunicatewithmorethanoneprocess.12/3/202267DistributedComputing,M.L.LiuStream-modeSocketAPIAstreamStream-modeSocketAPI InJava,thestream-modesocketAPIisprovidedwithtwoclasses:Serversocket:foracceptingconnections;wewillcallanobjectofthisclassaconnectionsocket.Socket:fordataexchange;wewillcallanobjectofthisclassadatasocket.12/3/202268DistributedComputing,M.L.LiuStream-modeSocketAPI InJavaStream-modeSocketAPIprogramflow12/3/202269DistributedComputing,M.L.LiuStream-modeSocketAPIprogramTheserver(theconnectionlistener)12/3/202270DistributedComputing,M.L.LiuTheserver(theconnectionlisKeymethodsintheServerSocketclassNote:Acceptisablockingoperation.12/3/202271DistributedComputing,M.L.LiuKeymethodsintheServerSockeKeymethodsintheSocketclassAreadoperationontheInputStreamisblocking.Awriteoperationisnonblocking.12/3/202272DistributedComputing,M.L.LiuKeymethodsintheSocketclasConnection-orientedsocketAPI-312/3/202273DistributedComputing,M.L.LiuConnection-orientedsocketAPIConnection-orientedsocketAPI-312/3/202274DistributedComputing,M.L.LiuConnection-orientedsocketAPIConnectionlesssocketAPI12/3/202275DistributedComputing,M.L.LiuConnectionlesssocketAPI11/30Example4EventDiagram12/3/202276DistributedComputing,M.L.LiuExample4EventDiagram11/30/2Example412/3/202277DistributedComputing,M.L.LiuExample411/30/202234DistributeSecureSockets

/products/jsse/Securesocketsperformencryptiononthedatatransmitted.TheJavaTMSecureSocketExtension(JSSE)isaJavapackagethatenablessecureInternetcommunications.ItimplementsaJavaversionofSSL(SecureSocketsLayer)andTLS(TransportLayerSecurity)protocolsItincludesfunctionalitiesfordataencryption,serverauthentication,messageintegrity,andoptionalclientauthentication.UsingJSSE,developerscanprovideforthesecurepassageofdatabetweenaclientandaserverrunninganyapplicationprotocol.12/3/202278DistributedComputing,M.L.LiuSecureSockets

http://java.sunTheJavaSecureSocketExtensionAPI

/products/jsse/doc/apidoc/index.htmlImport.ssl;ClassSSLServerSocketisasubclassofServerSocket,andinheritsallitsmethods.ClassSSLSocketisasubclassofSocket,andinheritsallitsmethods.TherearealsoclassesforCertificationHandshakingKeyManagerSSLsession12/3/202279DistributedComputing,M.L.LiuTheJavaSecureSocketExtensiSummaryInthischapter,weintroducedthesocketapplicationprograminterfaceforinterprocesscommunication.ThesocketAPIiswidelyavailableasaprogrammingfacilityforIPCatarelativelylowlevelofabstraction.12/3/202280DistributedComputing,M.L.LiuSummaryInthischapter,weintSummary-2UsingtheJavasocketAPIs,weintroducedtwotypesofsockets:Thedatagramsockets,whichusestheUserDatagramProtocol(UDP)atthetransportlayertoprovidethesendingandreceivingofdiscretedatapacketsknownasdatagrams.Thestream-modesocket,whichusestheTranportLayerProtocol(TCP)atthetransportlayertoprovidethesendingandreceivingofdataus

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论