计算机类数据通信实验中的套接字编程中英文翻译外文翻译外文文献翻译.docx
- 文档编号:23971981
- 上传时间:2023-05-23
- 格式:DOCX
- 页数:19
- 大小:29.30KB
计算机类数据通信实验中的套接字编程中英文翻译外文翻译外文文献翻译.docx
《计算机类数据通信实验中的套接字编程中英文翻译外文翻译外文文献翻译.docx》由会员分享,可在线阅读,更多相关《计算机类数据通信实验中的套接字编程中英文翻译外文翻译外文文献翻译.docx(19页珍藏版)》请在冰豆网上搜索。
计算机类数据通信实验中的套接字编程中英文翻译外文翻译外文文献翻译
附原文:
SOCKETPROGRAMMINGINTHEDATACOMMUNICATIONSLABORATORY
WilliamE.Toll
ComputingandSystemSciences
TaylorUniversity
Upland,IN46989
btoll@css.tayloru.edu
ABSTRACT
Althoughmanydatacommunicationscoursesaretaughtwithnoprogrammingcontentcoursesdesignedforcomputersciencemajorsshouldincludeprogramming.ManydatacommunicationscourseswithaprogrammingcomponentmakeuseofserialportsonPCswhilesomedealwithdetailednetworklayerprojects.UNIXsocketprogrammingallowsthestudentstodealwiththesameissuesandproblems,butinacontextthatismorelikelybeusefulandthatismoreinteresting.Inaddition,ifsocketclassesareusedwithC++,onlyasmuchdetailofsocketoperationasdesiredneedbepresented.
lNTRODUCTION
DatacommunicationsisastandardpartofmostMISandCSprograms.Theactualimplementationofthecoursevarieswidelyasevidencedbythevarietyoftextbooksavailable.Manytexts,whetherorientedtowardMISorCS,providelittleornolaboratoryactivity.MISprogramstendtoemphasizemanagementofdatacommunicationsandnetworks.Recentnewslistspostingsindicateanemphasisonusingdatacommunicationsandinvestigationsofthetypesandstylesofcommunicationavailable.National,orinternational,cooperativeprojectsarepopular.CSprogramsmayuseverytechnicaltextsorabroadtextsuchasusedbytheauthor[1]whereprinciples,designapproaches,andstandardsareemphasized.Obviously,anengineeringprogramwouldhaveamuchmoreextensiveanddetailedcourse(s)toinvestigatethephysicalandstructuralaspectsofdatacommunication.ThecoursetaughtbytheauthorisrequiredofallCSmajors.Studentsinthecoursemaybeinanyofthespecializedtracks(artificialintelligence,businessinformationsystems,graphicsorscientificprogramming)aswellasamoregenericCSmajor.
Thepossibletypesoflaboratoryexperiencesarealsobroad.The“globalcooperationmodel”teacheshowdatacommunicationsworksbyforcingstudentstousesophisticatedcommunicationsmechanismsandprovidesabasisforexplaininghowthesesystemsfunction.Itispossible,basedontheavailableresources,toconsiderdesignalternativesbyallowingstudentstoexploredifferentphysicalorlogicaltypesofcommunication.
Attheotherextremeareexercisesthatemphasizelow-levelphysicalunderstandingofdatacommunications-almostanengineeringapproach.AtypicalexamplewouldbetheuseofserialportsonPCs.Inadditiontowritingcodetomanipulatethephysicalhardware,manymorecomplicatedconceptscanbestudied.Inmaterialtheauthorhasusedinthepast,filetransferassignmentsusingamodifiedBiSynchprotocolandtokenringsareimplemented[2].Analternativelow-levelapproachismodeledbytheNetCpsoftware[3].Thislaboratoryapproachinvolvesalargescaleprojectbasedondevelopingthe0S11S0datalinklayer.
Noneoftheseapproachesprovidepracticalhands-onhardwareexperience.Inadditiontotheexercisesdescribedinthispaper,theauthorassignsaprojectinvolvinginstallationofhardwareandsoftwaretoaddaPCtoanetwork.Aservercanbeinstalledandconfiguredforextracredit.Suchaprojectwascontinuedwhenthesocketmodelwasadopted.
Studentsplacedinpracticalorintheirfirstjobhaveconsideredthedatacommunicationscourseimportant.TheyhavetypicallynotbelievedthePCserialportprogrammingtobeimportant,however.Theapproachpresentedhereisdesignedtoprovideabroadoverviewofdatacommunicationandnetworkissuestoourstudents.Thegoalsforthelaboratorypartofthedatacommunicationscoursearepresentedlaterinthepaper.
UNIXSOCKETS
Simplystatedsocketsareamechanismbywhichmessagesmaybesentbetweenprocessesonthesameordifferentmachines.Iftheprocessesareonthesamemachine,thesocketsmaybeusedaspipes.Internetsocketsallowcommunicationbetweenprocessesrunningondifferentmachines.Thesystemcallsarethesameasfilei/o.AtypicalapproachtosocketprogrammingistocreateaprocessthatopensaSewersocketportandlistensforanotherprocesstoattemptconnection.Aclientcanopenasocket,withthesameportnumberastheserversocket,requestingconnectiontotheservice.Whentheserverhearstherequestaconnectionisestablished.Communicationcannowproceedwithread()andwrite()
.
Therearemanytypesofstandardprotocols.TwoofthemostcommonareUDP(userdatagramprotocol)andTCP(transmissioncontrolprotocol).Bothprotocolstransmitpacketsofinformationbetweenprocessesviaasocket.UDPdoesnotprovideaguaranteethatdatawillbereceivedorthatamultiplepackettransmissionwillbereceivedinorder.TCPisastreamprotocolthatisreliableandsequenced.TotheprogrammerinputandoutputonaTCPsocketappearsasabytestreamfromaterminalorafile.IfTCPdatacannotbetransmittedsuccessfullywithinareasonableamountoftime,anerrorisindicated.ThereislessoverheadinvolvedinUDP,butprogrammingmustbemuchmoresophisticatediforderlymessagereceiptisimportant.
Thesocketconnectionbetweentwoprocessesisaconnectionbetweenhost.portpairswheretheportnumberindicatesaparticularservicethatismadeavailable.ManyoftheservicescommonlyavailableviaTCPsocketsarerecognizableacronyms:
SMTP(SimpleMailTransportProtocolusedfore-mail),NNTP(NetworkNewsTransportProtocol,usedforUsenetnews)andFIT(FileTransportProtocol).Telnetandrshareadditionalsocketservices.UNIXprovidesamechanismwherebythenameofanavailableservicesistranslatedtoaportnumber.
Socketsarealsousedfortheinterprocesscommunicationnecessaryinconcurrentorparallelprocessing.Therefore,parallelprocessingassignmentsaswellasdatacommunicationsprojectscanbebuiltonthesameframework.
ADVANTAGESOFSOCKETS
OneobviousdisadvantageofusingsocketprogrammingforthedatacommunicationslabisthatthereislessdirecthardwareinteractionthanwithPCserialports.However,mostgraduateswillnotbeinsituationswheresuchdetailedknowledgewillbeimportant.EvenwiththeserialportapproachtheconceptshaveremainedsomewhatabstracttomanystudentsThesocketbasedapproachhastheadvantagethattheabstractconceptsofsockets(andpracticalusessuchasmail,telnet,etc.)becomemuchmoreconcrete.
OneadvantagethatPCbasedlabshavehadinthepastisthattheywereinexpensive.However,thereareatleasttwofactorsthatbalancethisadvantage.OneisthatUNIXworkstationsarenowcommonlyavailable.PClabscanbeconvertedtoworkstationsbyinstallingfreeversionsofUNIX.Sincemost,ifnotall,socketassignmentsgiveninadatacommunicationscoursearenotcomputeintensiveanddonotrequireagraphicalinterface,workstationsneednotbededicatedtothecourseaswouldbetrueofPCs.AnotherfactoristhateventhoughPCsarerelativelyinexpensive,whathappenspracticallyisthatolder,lessreliable,machinesareassignedtoadedicatedprojectsuchasadatacommunicationslab.Ourexperiencewasthatthemachineswecould“afford”tousewerequiteunreliable.
Althoughthe“highlevel”natureofsocketprogramminghasbeenstressedasanadvantage,itispossibletomaketheassignmentsasdetailedasdesired.Socketprogrammingwithoutanysupportsoftwarecanrequireagreatdealof“lowlevel”understandingandmanipulation.OnesimplemodificationwouldbetobaseassignmentsonUDPpacketsratherthanTCPpackets.Muchadditionalprogramming(errorcheckingviaCRCS,sequencenumbers,acknowledgmentofreceiptnegativeacknowledgmentforreceiptofabadpacket)wouldbenecessary.WitheitherUDPorTCPpackets,properlydesignedhandshakingmechanismsmaybenecessaryforsuchapplicationsasfiletransfer.
Withserialportassignments,lecturetimewasdevotedtosuchlowlevelconceptsascontrol,statusanddataregisters,andparalleltoserialconversion.Withasocketbasedapproachanalogousconceptssuchaspacketheadersandnetworkandmachinebyteordercanbediscussed.Ifdesiredmanyofthetopicsappropriateforserialportcommunicationcanberequiredforsocketprogramsandmanyofthesameassignmentscanbegiven.Evenifhighlevelapplicationsareassigned,thestudentsmuststillunderstandthedifferencesbetweenstreamsandbuffers.
ADVANTAGESOFC++SOCKETCLASSES
Manyreferencesprovidedetailsofsocketcommunication[4,5,6].Thesereferencesprovideexamplesandideasforassignments.AUofthedetailofestablishingcommunications,convertingthecommunicationintoabufferedstreamanderrorcheckingcanbedonewithUNIXsystemcalls.Muchlowlevelunderstandingmayberequiredtowriteapplicationsthatarestable.
AwelldesignedsetofC++classescanbeconstructedwhichwillprovidethefullpowerofsocketswhilerequiringsimplesemantics.Itispossibletowriteclientstoestablishedservers,eventdrivenservers,pollingservers,etc.
TheauthorprovidedthestudentswithasetofC++socketclasseswrittenandcopyrightbyGnanasekaranSwaminathanoftheElectricalEngineeringDepartmentoftheUniversityofVirginia(gs4t@virginia.edu)[7].TheseroutineshavebeenwrittentoworkwithGNUlibg++andappearthesameastheiostreamlibrary.Theyareavailablefromftp.virginia.edu.Theseclasseshavefunctionedverywellfortheassignmentsgiven.Theinterfaceisthesameastheiostreamlibraryandprovidestype-safeinputandoutput,TherearesockstreamclassesintheUDPandTCPdomainsaswellasapipestreamclass.Thesockbufclassesarederivedfromthestreambufclassofthelibg++iostreamlibrary.Thus,studentsmustlearnaboutstreamsandbuffersfornon-socketinputandoutput.
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机 数据通信 实验 中的 套接 编程 中英文 翻译 外文 文献