基于socket的即时通讯的研究毕业设计 下载本文

烟台大学毕业论文(设计)

[摘要] 近年来,随着互联网技术的不断更新普及,人们的联系方式也发生着重大的改变。从当初的写信到现在的QQ和微信,这些无不说明着时代在进步。现在,市面上的即时通讯软件多种多样,比如QQ、微信、米聊和陌陌等,早已经改变了人们的交流方式,使人们能够随时随地地进行交流,分享身边的新鲜事。

而我们现有所熟悉的通信方式,已经满足不了日益加快的生活节奏的要求,实时准确的沟通成为必需。即时通讯软件作为一款加强人与人之间交流的软件应运而生,为我们的工作与生活带来了极大的方便,很大程度上提高了人们工作与学习的效率,加大了人际交往圈。良好的用户界面,简便的操作,无不显示着这类应用的广阔市场。

各个中小型企业更是建起了自己的局域网聊天平台。在局域网内,人们可以快速的分享文件与资料,不再需要面对面使用U盘拷贝了。在此背景下,我开发了一款基于局域网的socket即时通讯项目,方便在此局域网内的人员沟通与交流。本项目包括客户端与服务器端。客户端主要包括用户的注册登录、聊天、分组、群聊,和个人信息修改等。服务器端实现聊天信息的转发、数据库数据的修改。其中,服务器端在设计与实现过程中,采用的是多线程技术,使用了连接池,可以在单个程序中同时运行多个不同的线程,执行不同的任务,不同的客户端登陆时就开启一个线程监听。 [关键词] socket;动态更新;即时;TCP/UDP

烟台大学毕业论文(设计)

Abstract: With the updating and popularizing of the internet technology continually in recent years,the way of People contacting with each other is changing significantly.From the papers to the qq and weixin today,all that show the progress of the era.there are many kinds of instant communication softwares on the market,such as qq、weixin and so on,they have already changed the people’s Communication pattern,so that people can communicate anytime and anywhere,sharing anything new around.

However,the way to communicate that we are familiar now,has failed to meet the increasingly accelerated pace of life requirements,real time accurate communication become essential.The instant communication software as a software to enhance the exchange between people came into being,which has brought great convenience to our work and life,greatly improved the efficiency of people's work and learning,and increased interpersonal circle,Good user interface and simple operation, they are all show the broad market for this kind of application.

Many SMEs has built their own LAN chat platform.In the LAN, you can quickly share files and information,no longer need to use U disk to copy face to face.Under this background,I developed a socket instant communication project based on the LAN,to facilitate people's communication in the LAN.The project includes client and server.The client mainly includes user registration registry, chat, groups, group chat,and personal information changes, etc.The server achieves chat information forwarding and database modification.Among them, the server in the design and implementation process,I use the multi thread technology,which can run multiple different threads simultaneously in a single program,perform different tasks,as different client login,it will open a thread monitor.

Key words: socket;dynamic updates; instant; TCP / UDP

烟台大学毕业论文(设计)

目 录

1 绪 论 .................................................................... 1

1.1 本课题的研究意义及必要性 ......................................................................................... 1 1.2 相关领域国内外应用的现状及发展趋势 ..................................................................... 1 1.3 JAVA语言 .......................................................................................................................... 1

1.3.1 java发展史 ........................................................................................................... 1 1.3.1 java的网络应用 ............................................................................................... 2 1.3.2 socket通信原理 ............................................................................................... 3 1.4 MYSQL简介...................................................................................................................... 4

1.4.1 Mysql的优点 ........................................................................................................ 4 1.4.2 Mysql的特点 ........................................................................................................ 5

2 系统分析 .................................................................................................................................. 6

2.1 系统功能要求 ................................................................................................................. 6 2.2 系统开发功能 ................................................................................................................. 6 2.3 系统的可行性分析 ........................................................................................................ 7 3 详细设计 .................................................................................................................................. 8

3.1 功能模块划分 ................................................................................................................ 8

3.1.1 注册模块设计 .................................................................................................... 8 3.1.2 登录模块设计 .................................................................................................... 8 3.1.3 聊天模块设计 .................................................................................................... 9 3.1.4 文件传输模 ........................................................................................................ 9 3.2 数据库设计 .................................................................................................................... 9

3.2.1 设计原则 ............................................................................................................ 9 3.2.1 具体步骤 .......................................................................................................... 10 4 系统实现 ................................................................................................................................ 13

4.1 客户端的实现 .............................................................................................................. 13

4.1.1 登录模块的实现 .............................................................................................. 13 4.1.2 注册模块的具体实现 ...................................................................................... 14 4.1.3 聊天信息界面的实现 ...................................................................................... 16 4.2数据库端的实现 ........................................................................................................... 18 5 综合测试 ................................................................................................................................ 21

5.1简单功能 ....................................................................................................................... 21 5.1.1 登录和注册界面 .............................................................................................. 21 5.1.2 聊天界面 .......................................................................................................... 22 5.2查找好友功能 ............................................................................................................... 23 5.3 好友分组的移动与新建界面 ...................................................................................... 24 结 束 语 ...................................................................................................................................... 25

烟台大学毕业论文(设计)

致 谢 ............................................................................................................................................ 26 参考文献 ...................................................................................................................................... 27 附录A 部分代码 ......................................................................................................................... 28