所谓服务器听,是服务器端套接字并不定位具体的客户端.doc

所谓服务器听,是服务器端套接字并不定位具体的客户端.doc

ID:55460386

大小:91.50 KB

页数:14页

时间:2020-05-14

所谓服务器听,是服务器端套接字并不定位具体的客户端.doc_第1页
所谓服务器听,是服务器端套接字并不定位具体的客户端.doc_第2页
所谓服务器听,是服务器端套接字并不定位具体的客户端.doc_第3页
所谓服务器听,是服务器端套接字并不定位具体的客户端.doc_第4页
所谓服务器听,是服务器端套接字并不定位具体的客户端.doc_第5页
资源描述:

《所谓服务器听,是服务器端套接字并不定位具体的客户端.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、所谓服务器监听,是服务器端套接字并不定位具体的客户端套接字,而是处于等待连接的状态,实时监控网络状态。  所谓客户端请求,是指由客户端的套接字提出连接请求,要连接的目标是服务器端的套接字。为此,客户端的套接字必须首先描述它要连接的服务器的套接字,指出服务器端套接字的地址和端口号,然后就向服务器端套接字提出连接请求。  所谓连接确认,是指当服务器端套接字监听到或者说接收到客户端套接字的连接请求,它就响应客户端套接字的请求,建立一个新的线程,把服务器端套接字的描述发给客户端,一旦客户端确认了此描述,连接就建立好了

2、。而服务器端套接字继续处于监听状态,继续接收其他客户端套接字的连接请求。Networkprogramminginwindowsispossiblewithsockets.Asocketislikeahandletoafile.SocketprogrammingresemblesthefileIOasdoestheSerialCommunication.Youcanusesocketsprogrammingtohavetwoapplicationscommunicatewitheachother.Theappl

3、icationaretypicallyonthedifferentcomputersbuttheycanbeonsamecomputer.Forthetwoapplicationstotalktoeacheitheronthesameordifferentcomputersusingsocketsoneapplicationisgenerallyaserverthatkeepslisteningtotheincomingrequestsandtheotherapplicationactsasaclientan

4、dmakestheconnectiontotheserverapplication.Theserverapplicationcaneitheracceptorrejecttheconnection.Ifthe serveracceptstheconnection,adialogcanbeginwithbetweentheclientandtheserver. Oncetheclientisdonewithwhateveritneedstodoitcanclosetheconnectionwiththeserv

5、er.Connectionsareexpensiveinthesensethatserversallowfiniteconnectionstooccur. Duringthetimeclienthasanactiveconnectionitcansendthedatatotheserverand/orreceivethedata.Thecomplexitybeginshere.Wheneitherside(clientorserver)sendsdatatheothersideissupposedtoread

6、thedata.Buthowwilltheothersideknowwhendatahasarrived.Therearetwooptions-eithertheapplicationneedstopollforthedataatregularintervalsorthereneedstobesomesortofmechanismthatwouldenableapplicationtogetnotificationsandapplicationcanreadthedataatthattime.Well,aft

7、erallWindowsisaneventdrivensystemandthenotificationsystemseemsanobviousandbestchoiceanditinfactis. AsIsaidthetwoapplicationsthatneedtocommunicatewitheachother   needtomakeaconnectionfirst.Inorderforthetwoapplicationtomakeconnectionsthetwoapplicationsneedtoi

8、dentifyeachother(oreachother'scomputer).Computersonnetworkhaveauniqueidentifiercalled I.P.addresswhichisrepresentedindot-notationlike10.20.120.127etc.Letsseehowallthisworksin.NET.System.Net.SocketsName

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。