1、- I - 摘摘 要要 即时通讯(Instant Messaging)是目前Internet上最为流行的通讯方式,而各 种各样的即时通讯软件也层出不穷;服务提供商也提供了越来越丰富的通讯服务 功能。随着互联网的发展,即时通讯的运用将日益广泛。 本文围绕即时通讯的基本文字交流功能,设计了管理在线用户,维护在线用 户,实现文字通信的功能。本系统使用TCP和UDP协议作为传输层的协议,更加便 捷了用户之间的通讯和交友。 该系统为用户提供了一个集文字通信、在线信息、文件传输于一体的即时通 信平台。经过几个月的项目开发、测试,本即时通讯系统现已可以正常运行。 关键词:关键词:TCP/IP,C/S,Win
2、sock,即时通信系统,Visual Basic - II - ABSTRACT Instant Messaging is currently the most popular way to communicate on the Internet,by the way various Instant Messaging software have been continuously appearing; Service provider offers more and more communication services nowadays. As the development of the
3、 Internet, Instant Messaging will perform a wider use and is growing up day after day. This thesis is based on the function of exchange, which is the basic character of instant messaging system, online users management, safeguarding online users and exchange message are come true. This system has of
4、fered an instant messaging platform incorporating characters communication, online information and file transfer. Through several months develop and test cycle, this instant messaging system can already used to run now. Keywords: TCP/IP, C/S, Winsock, Instant Messenger System, Visual Basic - III - 目
5、录目录 摘要 I ABSTRACTII 第 1 章 绪论. 1 1.1 研究背景及意义. 1 1.2 网络即时通信软件的现状. 2 1.3 本文的内容安排. 3 第 2 章 实现网络即时通信软件的相关知识. 5 2.1 Winsock 的原理. 5 2.2 TCP/IP 协议的原理. 6 2.3 C/S 结构的概述. 7 2.4 基于 Socket 通信的基本应用模式 8 2.5 设计工具 Visual Basic 介绍. 9 2.6 本章小结. 10 第 3 章 网络即时通信软件的设计. 11 3.1 即时通信系统的需求分析. 11 3.1.1 基本需求. 11 3.1.2 协议需求. 11
6、 3.1.3 安全需求. 11 3.1.4 系统需求. 12 3.2 界面设计. 12 3.3 系统设计和功能的实现. 14 3.3.1 各模块的逻辑分析及设计. 14 3.3.2 系统代码的编写和功能的实现. 19 3.3.3 与服务器之间的通信. 25 3.4 本章小结. 26 第 4 章 结论. 27 4.1 完成的工作. 27 4.2 存在的问题和未来的展望. 27 4.2.1 存在的问题. 27 - IV - 4.2.2 未来的展望. 27 致谢. 29 参考文献. 30 附录 1 程序运行实例 31 - 1 - 第第 1 章章 绪论绪论 网络通信是指两台或多台计算机相连接,通过网络协议实现互相通信、共享 资源。客户机服务器结构是目前最为流行的网络通信模式,当两台计算机建立 连接时,服务器是运行在一方计算机上的应用程序,也称为宿主机,与其他计算 机连接的服务,并为被连接的计算机提供数据;客户机是运行在另一方计算机上 的应用程序,它请求与服务器连接。通常一台服务器可连接多台客户机。网络通 信能使多台计算机间数据的传送变得便利、快捷,不再受到距离的限制。网络即 时