文件名称:CHATROOM
-
所属分类:
- 标签属性:
- 上传时间:2014-06-05
-
文件大小:5.17kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
摘要:Java源码,网络相关,聊天程序
一个Java聊天程序服务端和客户端程序,C/S结构,ChatServer 类实现了一个聊天室服务器端, 此类有一个构造器, 在构造器中使用newServerSocket()建立一个Socket 连接。RunServer()方法中运行聊天服务,通过Socket 类的getInetAddress().getHostName() 方法获得主机名, 建立新的ChatHandler 对象实例, 在synchronized (clients)中取得与客户端的同步。内部类ChatHandler 继承了Thread 类,在此线程run()方法中处理一次交谈。Close()方法关闭与客户端的连接。
ChatRoom 类继承了Applet,在init()中通过new Frame()创建聊天窗体,并在此窗体中设置窗体布局。在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 Frame 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 Frame()创建聊天窗体,并在此窗体中设置窗体布局。在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 Frame 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
(系统自动生成,下载前可以参看下载内容)
下载文件列表
codefans.net/聊天/CHAT.HTML
codefans.net/聊天/CHAT.JAVA
codefans.net/聊天/CHATROOM.JAVA
codefans.net/聊天/CHATSERVER.JAVA
codefans.net/聊天
codefans.net
codefans.net/聊天/CHAT.JAVA
codefans.net/聊天/CHATROOM.JAVA
codefans.net/聊天/CHATSERVER.JAVA
codefans.net/聊天
codefans.net
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.