资源描述:
《基于winsock api的vc网络编程实战(practical programming of vc network based on winsock api)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、基于winsockapi的vc网络编程实战(PracticalprogrammingofVCnetworkbasedonWinsockAPI)PracticalprogrammingofVCnetworkbasedonWinsockAPIWiththerapiddevelopmentofcomputerinformationtechnology,theInternetismoreandmorecloselyrelatedtotheworkandlifeofhumansocietyIthasbecomeanimportant
2、wayandmeansforhumantoobtainandexchangeinformation.SofordevelopersatpresentNetworkprogrammingisanessentialskill.ThisexampledescribeshowtouseWinsockAPItowritenetworkapplications.First,therealizationmethodThemostcommonsolutioninnetworkprogrammingistheClient/Server(cl
3、ient/server)model.InthisschemeTheclientapplicationrequestsservicetotheserverprogram.AserviceroutineisusuallyinawellknownaddressListentorequestsforservices,thatistosay,theserviceprocessisdormantuntilacustomercomestothisserviceTheaddressoftheserviceputsforwardthecon
4、nectionrequest.Atthispoint,theserviceprogramis"awakened"andservesthecustomerRespondappropriatelytocustomerrequests.(noteAdministrator2011/11/316:52:04Blank)InordertofacilitatethenetworkprogrammingofthisClient/Servermodel,inearly90s,MicrosoftjoinedtheotherSeveralco
5、mpaniesjointlydevelopedasetofnetworkprogramminginterfaceunderWINDOWS,thatis,WindowsSocketsspecificationItisnotanetworkprotocol,butasetofopen,multiprotocolnetworkprogrammingunderWindowsInterface。TheWinsockisnowbasicallyimplementedwithoutprotocol,andyoucanuseWinsock
6、tocallitManyprotocolsareused,buttheTCP/IPprotocolismorefrequentlyused.SocketactuallyprovidesoneinthecomputerThecommunicationportcancommunicatewithanycomputerwithSocketinterfacethroughthisport.applicationprogramOnthenetworktransmission,thereceivedinformationisthrou
7、ghtheSocketinterfacetoachieve.MicrosoftdefinesWinsockclassesforVisualC++,suchastheCAsyncSocketclassandtheCSocketclassthatcomesfromCAsyncSocket.Theyareeasytouse,andreaderscancertainlyusetheseclassestoimplementtheirownnetworkprograms,ButinordertobetterunderstandtheW
8、insockAPIprogrammingtechnology,weexplorehowtousetheunderlyingAPIfunctiontoachieveasimpleWinsocknetworkshouldProgramdesign,respectively,explainshowtooper