1 / 67
文档名称:

基于JavaSocket通信程序设计.docx

格式:docx   大小:1,248KB   页数:67页
下载后只包含 1 个 DOCX 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

基于JavaSocket通信程序设计.docx

上传人:63229029 2017/9/27 文件大小:1.22 MB

下载得到文件列表

基于JavaSocket通信程序设计.docx

文档介绍

文档介绍:摘要
随着时代的发展,人们互相交流的方式也在逐渐变化,从原来的面对面,到电话、手机,然后到短信、E-mail,再到现在的QQ、微信,聊天变得越来越具有实时性和有效性。后才能够让人们相互交流。如果用户在工作时候连接网络,有可能因为网络的关系使得工作效率变低;也有可能因为网络的关系,让公司内部的资料被泄露出去,使公司收到损失。因此进行一个在局域网下的聊天工具的设计是很有必要的。
本文介绍了在局域网内实现相互收发消息的基本流程,并且编写了一个基于Socket的聊天窗口。这个简单的软件采用的是C/S结构模式,即客户端/服务器模式。这个软件可以让客户端和客户端能够进行通信,服务器端也能够对客户端进行发消息,还能够进行监听客户端的所有消息。不足之处是只能够启动一个服务器,所有的客户端只能够通过一个端口连接服务器进行通信。如果让客户端不看到不属于这个端口的其它客户发的消息,必须重新定义Server端,更改端口。本文用到了Sock编程、多线程、TCP/IP协议还有图形界面设计的控件编程的知识。
通过对程序进行测试,发现程序能够在同一个局域网下实现多人通信。我们也许通过路由器分配的IP,也可以利用现在流行的“免费WiFi”,让所有人连接WiFi,这样,也会给每个客户端分配IP地址,这样也就有了局域网,它并不需要外网的帮助。
关键词:局域网;Socket;多线程;TCP/IP
Abstract
With the development of the times, munication mode of people is changed gradually. Yesterday, municated with each other face to face, then we tell something to others using telephone, cellphone, and then using message, e-mail. Now we tell something to each other with QQ, MSN and wechat. Communication es more and more real-time and ephemeral. But the software we used should depend on the . If not, they are nothing. If we connect the Internent during working, we may not devote ourself into our jobs. And also, the important information may be leaked to let pany lost money. So it is important to design a software about chating in the LAN but not on the .
This paper intruduce that people send messages to each other in the local work. And Programming the chat window based on the Socket. This simple application use the C/S model. The C/S model is Client/Server model. This application can let the different client sends or receives messages. Server can send message to every client and it can get all messages of every client sends. There is a weak point that people can just start one server. All clients should use the port the server given. If we want to divide people, we should change the port and copy another “Server” code to start new server, then some people use this server and others use another server. This paper uses the knowledges about the Socket programming, multithreading