关于java聊天系统
无事写写 乐趣 public class Server{ static Socket socketlist[] = new Socket[1000]; public Server( int socketport ) throws IOException { listenForConnecting( socketport ); } //listenForConnecting方法用于侦听连接 private void listenForConnecting( int socketport ) throws IOException { ServerSocket serversocket = new ServerSocket( socketport ); //关键是侦听的部分,用一个while循环来实现 while (true) { Socket socket = serversocket.accept(); ServerSocket serversocket = new ServerSocket( socketport ); //关键是侦听的部分,用一个while循环来实现 while (true) { Socket socket = serversocket.accept();
用户评论