基于VC++的网络即时通信软件的设计与实现 下载本文

理工大学学士学位论文

摘 要

随着互联网技术的飞速发展基于网络的即时通信软件给我们带来诸多便利,也成为当今网络应用的主流。聊天工具作为当今使用最为广泛的即时通信工具之一,可以方便人们随时随地进行在线交流。本文就是模拟QQ聊天软件,开发一个包括文字聊天、文件传输等功能的聊天软件。

本文首先针对网络即时通信系统的功能需求进行了分析,然后按照系统的功能需求对系统的体系结构进行了设计,并针对各个功能模块的执行流程进行了详细的分析。系统采用功能强大的VC++作为开发平台,以C/S模式作为开发模式,客户端实现了用户注册、用户登录、用户信息查询、个人信息修改、查看在线人员、消息传送以及文件传输等功能,服务器端实现了服务启动停止、用户信息管理和数据消息处理等功能。

在系统实现过程中,将客户端与服务器端的功能分别实现,着重研究如何运用Socket编程技术和TCP/IP协议来实现通信交流,并采用多线程实现不同的并行任务。本系统最终能够应用于网络环境,应用数据库对通信用户及通信消息等进行管理。

关键词:网络即时通信系统;VC++;C/S模式;Socket编程

I

沈阳理工大学学士学位论文

Abstract

With the rapid development of Internet technology, the Chat Software of the instant messenger based on network brings many conveniences to us, also becomes the focus of network application in present. Chat is one of the most widespread instant messengers, may facilitate the people to carry on the online information exchange at anytime and anywhere. This project develops chat software, which includes the writing and file transfer and so on.

Firstly, analysis of functional requirements for instant network messaging system, and then follow the system's functional requirements, system architecture design, and carried out a detailed analysis of the implementation process for each functional module. System uses a powerful VC + + as a development platform, C / S model as a development model, the client achieve the user registration, user login, user information to view, personal information changes, messaging and file transfer and other functions, the server side to achieve the service start and stop the line to view the user information management and data messaging functions.

In the process of system implementation, the client and server side function respectively, this paper studies how to use the Socket programming technology and TCP/IP protocol to realize communication, using multi-threaded implementation different parallel tasks. This system eventually is used in a network environment, the application database to manage communications users and communication messages.

Keywords:Instant network messaging system; VC++; C/S mode; Socket Programming

II

沈阳理工大学学士学位论文

目 录

1 绪 论 ................................................................................................................................... 1 1.1 课题的背景及意义 ....................................................................................................... 1 1.2 课题的国内外研究现状 ............................................................................................... 1 1.3 课题研究的主要内容 ................................................................................................... 2 1.4 论文的组织结构 ........................................................................................................... 2

2 网络即时通信软件开发的相关技术 ................................................................................. 4 2.1 OSI七层网络模型 ........................................................................................................ 4 2.2 网络传输协议 ............................................................................................................... 4 2.2.1 TCP/IP协议 ........................................................................................................... 4 2.2.2 TCP协议和UDP协议 .......................................................................................... 5 2.3 C/S编程模型 ................................................................................................................ 6 2.4 Windows Sockets简介 ................................................................................................. 7 2.5 MFC Windows Socket类 ............................................................................................. 8 2.5.1 CAsyncSocket异步类 ........................................................................................... 8 2.5.2 CSocket类 .............................................................................................................. 8 2.6 MFC多线程编程技术 .................................................................................................. 9 2.7 Access数据库 ............................................................................................................. 10

3 网络即时通信软件开发的系统需求分析 ........................................................................ 12 3.1 系统实现目标 ............................................................................................................. 12 3.2 功能性需求描述 ......................................................................................................... 12 4 网络即时通信软件开发的系统总体设计 ........................................................................ 15 4.1 系统体系结构设计 ..................................................................................................... 15 4.2 系统功能模块介绍 ..................................................................................................... 16

III