2022年网络课程设计报告 .pdf
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《2022年网络课程设计报告 .pdf》由会员分享,可在线阅读,更多相关《2022年网络课程设计报告 .pdf(13页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、1 计算机网络课程设计报告学院:计算机科学学院专业:计算机科学与技术班级:姓名:学号:小组成员:2011-7-13 项目内容:基于 Socket 的文件传输服务设计与实现名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 13 页 - - - - - - - - - 2 实验目的:基于Socket套接口,实现文件数据传输服务。目的使学生掌握网络文件传输服务的设计方法。实验环境:操作系统: windowsXP 或 windows7;内存: 256M以上; Microsoft V
2、isual C+ 6.0 设计方案:文件传送是各种计算机网络实现的基本功能,文件传送协议是一种最基本的应用层协议按照客户/服务器的模式进行工作,提供交互式的访问,是INTERNET使用最广泛的协议之一。 文件传输协议的简单设计与实现建立在计算机网络实验环境TCP/IP 网络体系结构之上,使用socket 编程接口编写两个程序,分别为客户程序(client.c) 和服务器程序(server.c)首先,我们知道此应用软件需实现网络中多台主机的信息互通,实现文件传输,因此涉及到主机网络互联的问题,所以必须会应用到网络协议,可以用 UDP或 TCP 。利用 IP地址接受文件内容。实现流程: 启动电脑,
3、打开能运行该程序的环境,必须保证代码的正确性;进行窗体框架的设计,实现网络连接,并达到文件传输的功能;在以上步骤的成功进行下达到设计要求的基于Soc k et s的 局 域 网 内 文件 传 输 的 函 数 实 现 的 目 的 。源程序;程序清单:服务器:#include stdafx.h #include Server.h 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 13 页 - - - - - - - - - 3 #include ServerDlg.h #ifd
4、ef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE = _FILE_; #endif / / CServerDlg dialog CServerDlg:CServerDlg(CWnd* pParent /*=NULL*/) : CDialog(CServerDlg:IDD, pParent) /AFX_DATA_INIT(CServerDlg) / NOTE: the ClassWizard will add member initialization here /AFX_DATA_INIT / Note
5、 that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()-LoadIcon(IDR_MAINFRAME); void CServerDlg:DoDataExchange(CDataExchange* pDX) CDialog:DoDataExchange(pDX); /AFX_DATA_MAP(CServerDlg) / NOTE: the ClassWizard will add DDX and DDV calls here /AFX_DATA_MAP BEGIN_MESSA
6、GE_MAP(CServerDlg, CDialog) /AFX_MSG_MAP(CServerDlg) ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_BUTTON_LICSEN, OnButtonLicsen) ON_BN_CLICKED(IDC_BUTTON1, OnButtonOK) /AFX_MSG_MAP END_MESSAGE_MAP() / / CServerDlg message handlers BOOL CServerDlg:OnInitDialog() CDialog:OnInitDialog(); 名师资料总
7、结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 13 页 - - - - - - - - - 4 / Set the icon for this dialog. The framework does this automatically / when the applications main window is not a dialog SetIcon(m_hIcon, TRUE); / Set big icon SetIcon(m_hIcon, FALSE); / Set sm
8、all icon / TODO: Add extra initialization here return TRUE; / return TRUE unless you set the focus to a control / If you add a minimize button to your dialog, you will need the code below / to draw the icon. For MFC applications using the document/view model, / this is automatically done for you by
9、the framework. void CServerDlg:OnPaint() if (IsIconic() CPaintDC dc(this); / device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); / Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetC
10、lientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; / Draw the icon dc.DrawIcon(x, y, m_hIcon); else CDialog:OnPaint(); / The system calls this to obtain the cursor to display while the user drags / the minimized window. HCURSOR CServerDlg:OnQueryDrag
11、Icon() 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 13 页 - - - - - - - - - 5 return (HCURSOR) m_hIcon; void CServerDlg:OnButtonLicsen() / TODO: Add your control notification handler code here CFileDialog Dlg(TRUE); if(Dlg.DoModal()!=IDOK) return; CFile myFile
12、; if(!myFile.Open(Dlg.GetPathName(), CFile:modeRead | CFile:typeBinary) AfxMessageBox( 文件不存在 !,MB_OK|MB_ICONERROR); return; CSocket sockSrvr; sockSrvr.Create(800); sockSrvr.Listen(); CSocket sockRecv; sockSrvr.Accept(sockRecv); SOCKET_STREAM_FILE_INFO StreamFileInfo; WIN32_FIND_DATA FindFileData; Fi
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年网络课程设计报告 2022 网络 课程设计 报告
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内