/** * sendUserID: send id to the user print writer * * @return: the response */ protected String sendUserID() throws Exception { assert _userOut != null; String output = ProtocolConstants.PACK_STR_USR_HEAD + " " + _server.getID(); String reply = NetComm.sendAndRecv(output, _userOut, _userIn); return reply; }
/** * sendAll: send all of the information to the print writer * * @return: the response */ protected String sendAll() throws Exception { assert _out != null; String output = _server.getID() + " " + _server.getPrio() + " " + _server.getMaxClientNum(); Map<String, ClientNode> mp = _server.getClients(); Iterator it = mp.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); String name = (String) pair.getKey(); ClientNode node = (ClientNode) pair.getValue(); output += " " + name + " " + node.getPassword(); } output = ProtocolConstants.PACK_STR_ID_HEAD + " " + output; String reply = NetComm.sendAndRecv(output, _out, _in); return reply; }