聊天室的实现与设计

2019-03-29 18:26

兰州交通大学博文学院毕业设计(论文)

摘要

本聊天室设计初衷是为软件开发人员在局域网中方便交流,减少成本,消除由于交流不便带来的开发成本上升。本系统的开发主要用到了Oracle数据库技术、Hibernate框架、MVC架构技术、网络通信技术、windows的多线程技术等。本软件基于Socket通信,在此基础上,实现点对点聊天、广播聊天、一对多聊天、悄悄话,表情,可以运行于任何支持TCP/IP协议的机器上;对于数据库的连接则使用了Hibernate对象关系映射框架,基于此实现了对于系统消息和聊天记录的查询以及用户资料的查询和修改;对于软件整体架构则采用了MVC框架,这样可以大大增加系统的健壮性和可维护性。 MVC模式是一个复杂的架构模式,其实现也显得非常复杂。但是,我们已经总结出了很多可靠的设计模式,多种设计模式结合在一起,使MVC模式的实现变得相对简单易行。Views可以看作一棵树,显然可以用Composite Pattern来实现。Views和Models之间的关系可以用Observer Pattern体现。Controller控制Views的显示,可以用Strategy Pattern实现。Model通常是一个调停者,可采用Mediator Pattern来实现。

关键词 :网络通信;私人聊天;Hibernate;MVC;Socket

I

兰州交通大学博文学院毕业设计(论文)

Abstract

The original design intention of this chat room is facilitates the exchange for the software

developers in the local area network, reduces the cost, eliminates, because exchanges the development cost rise which brings differently. The development of chat room mainly to use network service technical, the file transfer technology, the windows and so on technology. This software based on the Socket correspondence, based on this, realizes chats, the broadcast to chat, one to many to chat point-to-point, the intimate conversation and the expression, may move in any supports the TCP/IP agreement on the machine. Connect to the database using the Hibernate object-relational mapping framework, based on the realization of system information for inquiries and chats, and user query and modify data; the overall framework for the software uses the MVC framework, it can greatly increase the system robust and maintainability.

MVC model structure is a complex model, which seems very complicated to achieve. However, we have summed up a lot of the design of a reliable model, combining a variety of design patterns, MVC model so become relatively easy to achieve. Views can be seen as a tree, apparently can be used to achieve the Composite Pattern. Views and Models of the relationship between the Observer Pattern can be reflected. Controller to control the display of Views can be used to achieve the Strategy Pattern. Model is usually a mediator can be used to achieve the Mediator Pattern。

Keyword: Network service;Personal chats;;Hibernate;MVC;Socket

II

兰州交通大学博文学院毕业设计(论文)

目录

1 系统概述 ............................................................... 1

1.1系统设计(研究)的背景、目的和意义 ................................ 1

1.1.1 系统开发的背景 .............................................. 1 1.1.2 系统开发的目的和意义 ........................................ 1 1.2 对已有聊天软件的分析 .............................................. 2

1.2.1 QQ .......................................................... 2 1.2.2 网页聊天室 .................................................. 2 1.2.3 本系统具有的优势 ............................................ 2 1.3 系统设计的环境与开发方案 .......................................... 2

1.3.1 系统开发环境 ................................................ 2 1.3.2 系统开发方案 ................................................ 3

2 关键技术介绍 ........................................................... 4

2.1 软件开发所采用的关键技术 .......................................... 4

2.1.1 Java语言简介 ................................................ 4 2.1.2 Socket通信技术 .............................................. 4 2.1.3 MVC模式 .................................................... 4 2.1.4 Hibernate框架技术 .......................................... 5 2.2 开发平台 .......................................................... 6

2.2.1 Eclipse简介 ................................................. 6

3 需求分析 ............................................................... 8

3.1 功能分析 .......................................................... 8 3.2 性能需求 .......................................................... 9 3.3 系统用例图 ........................................................ 9

3.3.1 服务器端 .................................................... 9 3.3.2 客户端 ..................................................... 10

4 系统设计 .............................................................. 11

4.1 系统功能模块设计 ................................................. 11

4.1.1 聊天室总体功能模块图 ....................................... 11 4.1.2 服务器端功能模块图 ......................................... 11

III

兰州交通大学博文学院毕业设计(论文)

4.1.3 客户端功能模块图 ........................................... 12 4.2 数据库设计 ....................................................... 12

4.2.1 数据库概念结构设计 ......................................... 12 4.2.2 数据库逻辑结构设计 ......................................... 12 4.2.3 数据库物理设计 ............................................. 13 4.3 聊天室服务器端设计 ............................................... 16

4.3.1 服务器设计思想 ............................................. 16 4.3.2 服务器端界面 ............................................... 17 4.3.3 服务器端各主要类的定义及其功能 ............................. 17 4.3.4 服务器端用户管理功能的设计 ................................. 18 4.3.5 服务器端显示消息的功能设计 ................................. 18 4.3.6 服务器保存系统消息日志功能的实现 ........................... 19 4.4 聊天室客户端设计 ................................................. 19

4.4.1 客户端设计思想 ............................................. 19 4.4.2客户端各主要类的定义以及功能 ................................ 19 4.4.3客户端发送消息的设计 ........................................ 20 4.4.4 客户端显示收到消息的设计 ................................... 20 4.4.5 系统消息查询的设计 ......................................... 20 4.4.6 聊天记录查询的设计 ......................................... 20 4.4.7 在线用户资料的查询 ......................................... 20 4.4.8 修改个人注册资料的设计 ..................................... 20 4.4.9 个人聊天记录的删除功能设计 ................................. 21

5 系统实现 .............................................................. 22

5.1 登陆界面的实现 ................................................... 22 5.2 注册界面的实现 ................................................... 23 5.3 服务器端模块功能实现 ............................................. 25

5.3.1 显示在线用户功能实现 ....................................... 25 5.3.2 公聊功能实现 ............................................... 28 5.3.3私聊功能实现 ................................................ 28 5.3.4 服务器端显示信息和发送信息功能实现 ......................... 29 5.3.5 服务器保存系统日志功能实现 ................................. 30

IV

兰州交通大学博文学院毕业设计(论文)

5.4 客户端模块功能实现 ............................................... 31

5.4.1 客户端接受信息功能实现 ..................................... 31 5.4.2 客户端发送消息功能实现 ..................................... 33 5.4.3 查询系统信息功能实现 ....................................... 34 5.4.4 查询聊天记录功能实现 ...................................... 34 5.4.5 用户资料查询功能实现 ....................................... 35 5.4.6 个人资料更新功能实现 ....................................... 36 5.4.7 聊天记录删除功能实现 ....................................... 37

结论 .................................................................... 38 致谢 .................................................................... 38 参考文献 ................................................................ 40

V


聊天室的实现与设计.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2017年中国螺丝发展现状与市场前景分析(目录) - 图文

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: