聊天系统毕业论文 下载本文

基于局域网的通讯系统的设计

摘 要

随着计算机科学和Internet 的飞速发展, 网上聊天已成为人们相互交流的一种方式, 与E-mail、电话相比, 聊天服务更具有实时性和有效性。

本论文提出一个运行于VC平台上的局域网聊天软件的解决方案。该聊天软件包括服务器端和客户端两个模块,客户端通过服务器端进行通信。服务器端模块主要实现了服务器的配置和数据的传递;客户端模块主要实现了用户注册、登录、文字聊天等功能。该软件采用异步套接字的非阻塞模式,并实现对象的序列化和MFC文件对象实现数据的保存。

该软件能够帮助企业在局域网内搭建起自己的聊天系统,避免企业内部员工使用类似QQ等软件泄露内部信息,但是该软件只实现了聊天的基本功能,还有很多不足之处需要改进。

关键字:局域网、聊天系统

I

LAN-based communication system design chat

Abstract

Along with the high-speed development of the computer science and Internet, chatting on line has been an important method in our communication. Comparing with E-mail and telephone, the chat-line service is more real-time and effective.

This thesis proposes a solution of a LAN chatting software based on C++ language, which is operated on the VC platform. This chatting software includes two modules: the server and the client, which can communicate with each other. The server module mainly completes the sever device’s configuration. The client module mainly completes the users’ login, registration, instant messaging and so on. The software used model of non-blocking asynchronous socket , And to achieve the object and MFC series documents the preservation of the object data.

This software can help the company to build their own chatting system in the local area network, and it also can avoid the staff of the company disclosing the insider information by using the other software such as QQ, but this software has only completed the basic function as a chatting system, so it need much more improvement.

Key words:LAN 、Chat

目 录

II

摘 要 -------------------------------------------------------------------------------------------------------- I Abstract ------------------------------------------------------------------------------------------------------- II

1 概 述 --------------------------------------------------------------------------------------------------------3

1.1 系统现状----------------------------------------------------------------------------------------------- 1 1.2 系统内容与目标-------------------------------------------------------------------------------------- 2 1.3 系统综述----------------------------------------------------------------------------------------------- 2

2 系统开发环境和关键技术 --------------------------------------------------------------------------3

2.1 开发环境----------------------------------------------------------------------------------------------- 3 2.2 关键技术----------------------------------------------------------------------------------------------- 3

2.2.1 .Visual C++和面向对象程序设计 ------------------------------------------------------------------------------ 3 2.2.2 M F C ---------------------------------------------------------------------------------------------------------------------- 4 2.2.3 WINDOWS SOCKETS网络编程接口--------------------------------------------------------------------------------- 4 2.2.4 WSAAsyncSelect模型开发 ----------------------------------------------------------------------------------------- 5 2.2.5 TCP/IP协议、TCP协议 --------------------------------------------------------------------------------------------- 6 2.2.6 Client/Server结构(客户机/服务器模式) -------------------------------------------------------------- 8

3 系统分析与设计 ---------------------------------------------------------------------------------------9

3.1 系统分析----------------------------------------------------------------------------------------------- 9

3.1.1 系统需求 ----------------------------------------------------------------------------------------------------------------- 9 3.1.2 需求分析 ---------------------------------------------------------------------------------------------------------------- 10

3.2 系统设计--------------------------------------------------------------------------------------------- 11

3.2.1 设计原则 ---------------------------------------------------------------------------------------------------------------- 11 3.2.3 工作流程 ---------------------------------------------------------------------------------------------------------------- 12 3.2.4 功能设计 ---------------------------------------------------------------------------------------------------------------- 12 3.2.5 共享数据类设计-------------------------------------------------------------------------------------------------------- 13

4 系统实现----------------------------------------------------------------------------------------------- 16

4.1 服务器端设计实现 --------------------------------------------------------------------------------- 16

4.1.1 服务器端静态类图--------------------------------------------------------------------------------------------------- 16 4.1.2 服务器主要类介绍--------------------------------------------------------------------------------------------------- 16 4.1.3 服务器端主要过程介绍 -------------------------------------------------------------------------------------------- 19

4.2 客户端设计实现------------------------------------------------------------------------------------ 25

4.2.1 客户端静态类图 ------------------------------------------------------------------------------------------------------ 25 4.2.2 客户端主要类介绍--------------------------------------------------------------------------------------------------- 25 4.2.3客户端主要过程介绍 ------------------------------------------------------------------------------------------------ 27

4.3系统测试 --------------------------------------------------------------------------------------------- 32 4.3.1 测试意义------------------------------------------------------------------------------------------ 32

4.3.2软件测试的目标 ------------------------------------------------------------------------------------------------------- 32 4.3.2软件测试的方法 ------------------------------------------------------------------------------------------------------- 32 4.3.3 测试用例 ---------------------------------------------------------------------------------------------------------------- 33

总结与展望 ------------------------------------------------------------------------------------------------- 34