processing.net
Class Server

java.lang.Object
  extended by processing.net.Server
All Implemented Interfaces:
java.lang.Runnable

public class Server
extends java.lang.Object
implements java.lang.Runnable


Field Summary
 int clientCount
          Number of clients currently connected.
 Client[] clients
          Array of client objects, useful length is determined by clientCount.
 
Constructor Summary
Server(PApplet parent, int port)
           
 
Method Summary
 Client available()
          Returns the next client in line that has something to say.
 void disconnect(Client client)
          Disconnect a particular client.
 void dispose()
          Disconnect all clients and stop the server: internal use only.
 void run()
           
 void stop()
          Disconnect all clients and stop the server.
 void write(byte[] what)
          Write a byte array to all the connected clients.
 void write(int what)
          Write a value to all the connected clients.
 void write(java.lang.String what)
          Write a String to all the connected clients.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clientCount

public int clientCount
Number of clients currently connected.


clients

public Client[] clients
Array of client objects, useful length is determined by clientCount.

Constructor Detail

Server

public Server(PApplet parent,
              int port)
Method Detail

disconnect

public void disconnect(Client client)
Disconnect a particular client.


available

public Client available()
Returns the next client in line that has something to say.


stop

public void stop()
Disconnect all clients and stop the server.

Use this to shut down the server if you finish using it while your applet is still running. Otherwise, it will be automatically be shut down by the host PApplet using dispose(), which is identical.


dispose

public void dispose()
Disconnect all clients and stop the server: internal use only.


run

public void run()
Specified by:
run in interface java.lang.Runnable

write

public void write(int what)
Write a value to all the connected clients. See Client.write() for operational details.


write

public void write(byte[] what)
Write a byte array to all the connected clients. See Client.write() for operational details.


write

public void write(java.lang.String what)
Write a String to all the connected clients. See Client.write() for operational details.