This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Class

Server

Name

active()

Examples
import processing.net.*;

Server myServer;
int val = 0;

void setup() {
  size(200, 200);
  // Starts a myServer on port 5204
  myServer = new Server(this, 5204); 
}

void draw() {
  val = (val + 1) % 255;
  background(val);
  if (myServer.active() == true) {
    myServer.write(val);
  } else {
    println("Server is not active."); 
  }
}

void mousePressed() {
  myServer.stop();
}

Description Returns true if this server is still active and hasn't run into any trouble.
Syntax
server.active()
Parameters
server Server: any variable of type Server
Returnsboolean
Updated on January 21, 2019 10:05:14am EST

Creative Commons License