Skip to content
This repository was archived by the owner on Sep 19, 2021. It is now read-only.

Fixed OSC Server/Client connection for new api calls #103

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -203,4 +203,4 @@ public static void main(String[] args) throws Exception {
new PixConClient(cmd);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down