文件名称:Java-liaotian

  • 所属分类:
  • 游戏
  • 资源属性:
  • 上传时间:
  • 2014-09-04
  • 文件大小:
  • 6kb
  • 下载次数:
  • 0次
  • 提 供 者:
  • hei***
  • 相关连接:
  • 下载说明:
  • 别用迅雷下载,失败请重下,重下不扣分!
下载
别用迅雷、360浏览器下载。
如迅雷强制弹出,可右键点击选“另存为”。
失败请重下,重下不扣分。

介绍说明--下载内容均来自于网络,请自行研究使用

一个Java聊天程序服务端和客户端程序,C/S结构,ChatServer 类实现了一个聊天室服务器端, 此类有一个构造器, 在构造器中使用newServerSocket()建立一个Socket 连接。RunServer()方法中运行聊天服务,通过Socket 类的getInetAddress().getHostName() 方法获得主机名, 建立新的ChatHandler 对象实例, 在synchronized (clients)中取得与客户端的同步。内部类ChatHandler 继承了Thread 类,在此线程run()方法中处理一次交谈。Close()方法关闭与客户端的连接。

  ChatRoom 类继承了Applet,在init()中通过new fr a me()创建聊天窗体,并在此窗体中设置窗体布局。在login()方法中,通过new Socket(serverHost, port)建立与服务器的连接,通过new Thread()产生新的聊天线程。在logout()方法中,使用sock.close()关闭连接。-A Java chat server and client service procedures, C/S structure, ChatServer class implements a chat room on the server side, such a constructor, use newServerSocket in the constructor () to create a Socket connection. RunServer () method to run the chat service, (). GetHostName () method to get the host name through the Socket class getInetAddress, create a new ChatHandler object instance, to synchronize with the client synchronized (clients) in. Internal class ChatHandler inherited Thread class, in this thread run () method of processing a conversation. Close () method closes the connection with the client. ChatRoom class inherits Applet, () to create a chat window by new fr a me init () in, and set the form layout in this form. In the login () method to establish a connection with the server via new Socket (serverHost, port), to generate new chat thread through new Thread (). In the logout () method, using sock.close () closes the connection.
(系统自动生成,下载前可以参看下载内容)

下载文件列表





Java聊天程序服务端和客户端程序

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度更多...
  • 请直接用浏览器下载本站内容,不要使用迅雷之类的下载软件,用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.

相关评论

暂无评论内容.

发表评论

*主  题:
*内  容:
*验 证 码:

源码中国 www.ymcn.org