Exemplo n.º 1
0
 @ServiceHandler(RequestCmd.REMOTE_CONTROL)
 public void remoteControl(DataInputX din, DataOutputX dout, boolean login) throws IOException {
   MapPack param = (MapPack) din.readPack();
   long session = param.getLong("toSession");
   RemoteControl control =
       new RemoteControl( //
           param.getText("command"), //
           System.currentTimeMillis(), //
           param,
           param.getLong("fromSession"));
   boolean result = RemoteControlManager.add(session, control);
   Logger.println(
       "["
           + RequestCmd.REMOTE_CONTROL
           + "]"
           + control.commnad()
           + " from "
           + LoginManager.getUser(control.commander()).ip()
           + " to "
           + LoginManager.getUser(session).ip()
           + " "
           + result);
   MapPack m = new MapPack();
   if (result) {
     m.put("success", new BooleanValue(true));
     dout.writeByte(TcpFlag.HasNEXT);
     dout.writePack(m);
   } else {
     m.put("success", new BooleanValue(false));
     dout.writeByte(TcpFlag.HasNEXT);
     dout.writePack(m);
   }
 }
Exemplo n.º 2
0
 @ServiceHandler(RequestCmd.REMOTE_CONTROL_ALL)
 public void remoteControlAll(DataInputX din, DataOutputX dout, boolean login) throws IOException {
   MapPack param = (MapPack) din.readPack();
   RemoteControl control =
       new RemoteControl( //
           param.getText("command"), //
           System.currentTimeMillis(), //
           param,
           param.getLong("fromSession"));
   LoginUser[] users = LoginManager.getLoginUserList();
   for (int i = 0, len = (users != null ? users.length : 0); i < len; i++) {
     long session = users[i].session();
     RemoteControlManager.add(session, control);
   }
   Logger.println(
       "["
           + RequestCmd.REMOTE_CONTROL_ALL
           + "]"
           + control.commnad()
           + " from "
           + LoginManager.getUser(control.commander()).ip());
 }