MCPcopy Index your code
hub / github.com/processing/processing / available

Method available

java/libraries/net/src/processing/net/Server.java:226–251  ·  view source on GitHub ↗

( begin auto-generated from Server_available.xml ) Returns the next client in line with a new message. ( end auto-generated ) @brief Returns the next client in line with a new message. @webref server @usage application

()

Source from the content-addressed store, hash-verified

224 * @usage application
225 */
226 public Client available() {
227 synchronized (clientsLock) {
228 int index = lastAvailable + 1;
229 if (index >= clientCount) index = 0;
230
231 for (int i = 0; i < clientCount; i++) {
232 int which = (index + i) % clientCount;
233 Client client = clients[which];
234 //Check for valid client
235 if (!client.active()){
236 removeIndex(which); //Remove dead client
237 i--; //Don't skip the next client
238 //If the client has data make sure lastAvailable
239 //doesn't end up skipping the next client
240 which--;
241 //fall through to allow data from dead clients
242 //to be retreived.
243 }
244 if (client.available() > 0) {
245 lastAvailable = which;
246 return client;
247 }
248 }
249 }
250 return null;
251 }
252
253
254 /**

Callers

nothing calls this directly

Calls 3

activeMethod · 0.95
removeIndexMethod · 0.95
availableMethod · 0.95

Tested by

no test coverage detected