package server;import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.net.ServerSocket;import java.net.Socket;public class ServerReader extends Thread{ private Socket socket; private Server server; public ServerReader(Socket socket,Server server) { this.socket= socket; this.server= server; } public void run() { try{ BufferedReader br =new BufferedReader(new InputStreamReader(socket.getInputStream())); while(true) { String str=br.readLine(); if(str.startsWith("zhuce: ")) { String[] arr =str.split("pwd1"); String nickName =arr[1]; String pwd=arr[2]; //28行if(!server.getUserMap().containsKey(nickName)) { server.getUserMap().put(nickName, pwd); System.out.println("注册成功!!"); } else { System.out.println("注册失败!!"); } } } } catch(IOException e) { e.printStackTrace(); } } }
添加回答
举报
0/150
提交
取消