- 20
- 0
- 约2.12万字
- 约 20页
- 2020-09-16 发布于河北
- 举报
java 聊天程序源代码
服务端:
import java.io.*;
import .*;
import java.util.*;
public class ChatServer {
boolean stat = false;
ServerSocket ss = null;
ListClient clients = new ArrayListClient();// 用于存客户端
public static void main(String[] args) {
new ChatServer().start();
}
public void start(){
try {
ss = new ServerSocket(8888);
stat = true;
} catch(BindException e){ //Sever 端已经运行,当重复运行时抛异常
System.out.println( 端口正在使用中。。。。 );
System.out.println( 请关掉相关程序并重新运行服务器! ); // 还会抛别的异常,
原创力文档

文档评论(0)