use of de.janrufmonitor.service.server.ClientRegistry in project janrufmonitor by tbrandt77.
the class ConsoleServerStatus method execute.
public void execute() {
System.out.println("Server Status:");
System.out.println("--------------");
System.out.println();
IService server = getRuntime().getServiceFactory().getService("Server");
if (server != null && server.isRunning()) {
System.out.println("Server started on Port " + getRuntime().getConfigManagerFactory().getConfigManager().getProperty("service.Server", "port"));
System.out.println();
}
ClientRegistry cr = ClientRegistry.getInstance();
System.out.println("Connected clients: " + cr.getClientCount());
System.out.println();
if (cr.getClientCount() > 0) {
System.out.println("Client details:");
System.out.println("---------------");
System.out.println();
List clients = cr.getAllClients();
Client c = null;
for (int i = 0; i < clients.size(); i++) {
c = (Client) clients.get(i);
System.out.println("Client: " + c.getClientName() + " (" + c.getClientIP() + ")");
System.out.println("Port: " + c.getClientPort());
System.out.println("Send [bytes]: " + c.getByteSend());
System.out.println("Received [bytes]: " + c.getByteReceived());
System.out.println("---");
}
}
}
Aggregations