文件名称:CHATROOM
- 所属分类:
- JSP源码/Java
- 资源属性:
- 上传时间:
- 2014-06-05
- 文件大小:
- 5kb
- 下载次数:
- 0次
- 提 供 者:
- y**
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
摘要:Java源码,网络相关,聊天程序
一个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()关闭连接。-Summary: Java source code, network-related, a Java chat program chat program and client service procedures, C/S structure, ChatServer class implements a chat room server, such a constructor, to use in the constructor newServerSocket ( ) to establish a Socket connection. RunServer () method to run the chat service, (). GetHostName () method to obtain the host name through the Socket class getInetAddress, create a new object instance ChatHandler, synchronized 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 produce a new chat thread through new Thread (). In the logout () method, using sock.close () closes the
一个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()关闭连接。-Summary: Java source code, network-related, a Java chat program chat program and client service procedures, C/S structure, ChatServer class implements a chat room server, such a constructor, to use in the constructor newServerSocket ( ) to establish a Socket connection. RunServer () method to run the chat service, (). GetHostName () method to obtain the host name through the Socket class getInetAddress, create a new object instance ChatHandler, synchronized 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 produce a new chat thread through new Thread (). In the logout () method, using sock.close () closes the
(系统自动生成,下载前可以参看下载内容)
下载文件列表
(没有文件,原文件不完全或已损坏或有密码)