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

Class

Server

Name

disconnect()

Examples
// Example by Tom Igoe

import processing.net.*;

int port = 10002;
Server myServer;

void setup()
{
  size(400, 400);
  background(0);
  myServer = new Server(this, port);
}

void draw()
{
  // Get the next available client
  Client thisClient = myServer.available();
  // If the client is not null, and says something, display what it said:
  if (thisClient !=null) {
    String whatClientSaid = thisClient.readString();
    // If the client says "exit", disconnect it
    if (whatClientSaid.equals("exitrn")) {
      thisClient.write("You will be disconnected now.rn");
      println(thisClient.ip() + "t has been disconnected");
      myServer.disconnect(thisClient);
    } 
  } 
}

Description Disconnect a particular client.
Syntax
server.disconnect(client)
Parameters
server Server: any variable of type Server
client Client: the client to disconnect
Returnsvoid
Updated on May 19, 2014 05:30:04pm PDT

Creative Commons License