- 1、本文档共15页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
实验报告
实验名称
Windows Socket 编程
课程名称
计算机网络
一、 实验目的
目的:
(1)掌握网络应用程序的开发方法;
(2)掌握Client/ Server 结构软件的设计与开发方法;
(3)掌握Socket 机制的工作原理。
要求:
(1)完成客户端与服务器之间信息的互传;
(2)模拟的四种停止等待协议情况;
(3)实现多客户端间信息交互(选作)。
二、 实验环境
Windows 操作系统,VC 6 开发环境
三、实验内容与结果
(1)实验程序
实验共有两个程序,client和server,分别代表客户端和服务器并实现相应功能。
(2)实现功能
本实验一共需实现5个功能:服务器和客户端的双向通信和四种停止等待协议的模拟,四种停止等待协议的示意图如下
(3)重要的算法
本实验采用了sleep函数模拟四种停止等待协议发生时的时间关系。
(4)实验结果
1.服务器与客户端的双向通信
Client
Server
server.exe
[simplex-talk server] server is ready in listening ...
client.exe localhost
[simplex-talk server] received a connection from
127.0.0.1 :
[simplex-talk client] connection to localhost is
ready
[simplex-talk client] please input your message
(empty input to halt):
dfghgj
[simplex-talk client] send 7 chars to server
[simplex-talk server] received 7 chars
dfghgj
dfghgd
[simplex-talk server] send 7 chars to client
[simplex-talk client] received 7 chars
dfghgd
[simplex-talk client] empty message is send to
server
[simplex-talk client] connection is terminated
[simplex-talk server] empty message is received
[simplex-talk server] connection from 127.0.0.1 is
terminated
2.客户端消息到达服务器并返回ACK!
Client
Server
server.exe
[simplex-talk server] server is ready in listening ...
client.exe localhost
[simplex-talk server] received a connection from
127.0.0.1 :
[simplex-talk client] connection to localhost is
ready
[simplex-talk client] please input your message
(empty input to halt):
dfghgj
[simplex-talk client] send 7 chars to server
[simplex-talk server] received 7 chars
Dfghgj
ACK!
[simplex-talk server] send 5 chars to client
[simplex-talk client] received 5 chars
ACK!
[simplex-talk client] empty message is send to
server
[simplex-talk client] connection is terminated
[simplex-talk server] empty message is received
[simplex-talk server] connection from 127.0.0.1 is
terminated
3.客户端消息未到达服务器
Client
Server
server.exe
[simplex-talk server] server is ready in listening ...
client.exe localhost
[simplex-talk server] received a connection from
127.
文档评论(0)