(String[] args)
| 129 | |
| 130 | |
| 131 | static boolean sendArguments(String[] args) { //, long timeout) { |
| 132 | try { |
| 133 | Messages.log("Checking to see if Processing is already running"); |
| 134 | int port = Preferences.getInteger(SERVER_PORT); |
| 135 | String key = Preferences.get(SERVER_KEY); |
| 136 | |
| 137 | Socket socket = null; |
| 138 | try { |
| 139 | socket = new Socket(InetAddress.getLoopbackAddress(), port); |
| 140 | } catch (Exception ignored) { } |
| 141 | |
| 142 | if (socket != null) { |
| 143 | Messages.log("Processing is already running, sending command line"); |
| 144 | PrintWriter writer = PApplet.createWriter(socket.getOutputStream()); |
| 145 | writer.println(key); |
| 146 | for (String arg : args) { |
| 147 | writer.println(arg); |
| 148 | } |
| 149 | writer.flush(); |
| 150 | writer.close(); |
| 151 | return true; |
| 152 | } |
| 153 | } catch (IOException e) { |
| 154 | Messages.err("Error sending commands to other instance", e); |
| 155 | } |
| 156 | Messages.log("Processing is not already running (or could not connect)"); |
| 157 | return false; |
| 158 | } |
| 159 | } |
no test coverage detected