MCPcopy Index your code
hub / github.com/benfry/processing4 / sendArguments

Method sendArguments

app/src/processing/app/SingleInstance.java:131–158  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

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}

Callers 1

alreadyRunningMethod · 0.95

Calls 8

logMethod · 0.95
getIntegerMethod · 0.95
getMethod · 0.95
createWriterMethod · 0.95
errMethod · 0.95
printlnMethod · 0.45
flushMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected