分布式計算原理與應(yīng)用(Distributed-Computing)第四章課件_第1頁
分布式計算原理與應(yīng)用(Distributed-Computing)第四章課件_第2頁
分布式計算原理與應(yīng)用(Distributed-Computing)第四章課件_第3頁
分布式計算原理與應(yīng)用(Distributed-Computing)第四章課件_第4頁
分布式計算原理與應(yīng)用(Distributed-Computing)第四章課件_第5頁
已閱讀5頁,還剩81頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論