diff --git a/pixelcontroller-cli/src/main/java/com/neophob/sematrix/cli/PixConClient.java b/pixelcontroller-cli/src/main/java/com/neophob/sematrix/cli/PixConClient.java index 493f3315..3fffc66e 100644 --- a/pixelcontroller-cli/src/main/java/com/neophob/sematrix/cli/PixConClient.java +++ b/pixelcontroller-cli/src/main/java/com/neophob/sematrix/cli/PixConClient.java @@ -76,7 +76,7 @@ protected PixConClient(ParsedArgument cmd) throws OscServerException, OscClientE } // send request - rmi.startClient(NETWORK_PROTOCOL, cmd.getHostname(), cmd.getPort(), LOCAL_SERVER_PORT); + rmi.startClient(NETWORK_PROTOCOL, cmd.getHostname(), cmd.getPort(), 0); Command cmdAndParameter = new Command(cmd.getCommand(), new String[] { cmd.getParameter() }); rmi.sendPayload(cmdAndParameter, null); @@ -203,4 +203,4 @@ public static void main(String[] args) throws Exception { new PixConClient(cmd); } -} \ No newline at end of file +} diff --git a/pixelcontroller-core/src/main/java/com/neophob/sematrix/core/osc/OscReplyManager.java b/pixelcontroller-core/src/main/java/com/neophob/sematrix/core/osc/OscReplyManager.java index 3361f907..5dd0dd62 100644 --- a/pixelcontroller-core/src/main/java/com/neophob/sematrix/core/osc/OscReplyManager.java +++ b/pixelcontroller-core/src/main/java/com/neophob/sematrix/core/osc/OscReplyManager.java @@ -81,20 +81,24 @@ private void sendOscMessage(ValidCommand cmd) throws OscClientException { // handle all "INTERNAL" commands, eg. API calls public void handleClientResponse(OscMessage oscIn, String[] msg) throws OscClientException { + Protocol NETWORK_PROTOCOL = Protocol.UDP; + int LOCAL_SERVER_PORT = 10009; ValidCommand cmd = ValidCommand.valueOf(msg[0]); Command command = new Command(cmd); if (oscIn != null) { InetSocketAddress currentTarget = (InetSocketAddress) oscIn.getSocketAddress(); - int clientPort = currentTarget.getPort(); + if (!currentClientIp.equalsIgnoreCase(currentTarget.getHostName())) { LOG.log(Level.INFO, "New Client connection, IP: {0}/{1}, Port: {2}", new Object[] { - remoteServer.getClientTargetIp(), currentTarget.getHostName(), clientPort }); - remoteServer.startClient(Protocol.TCP, currentTarget.getHostName(), clientPort, 0); + remoteServer.getClientTargetIp(), currentTarget.getHostName(), LOCAL_SERVER_PORT }); + remoteServer.startClient(NETWORK_PROTOCOL, currentTarget.getHostName(), LOCAL_SERVER_PORT, 0); currentClientIp = currentTarget.getHostName(); } } + LOG.log(Level.INFO, cmd.toString() + " received."); + switch (cmd) { case GET_CONFIGURATION: remoteServer.sendPayload(command, pixelController.getConfig());