Part of the Processing project - http://processing.org
Copyright (c) 2004-2007 Ben Fry and Casey Reas
The previous version of this code was developed by Hernando Barragan
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
*/
packageprocessing.net;
importprocessing.core.*;
importjava.io.*;
importjava.lang.reflect.*;
importjava.net.*;
/**
* ( begin auto-generated from Server.xml )
*
* A server sends and receives data to and from its associated clients
* (other programs connected to it). When a server is started, it begins
* listening for connections on the port specified by the <b>port</b>
* parameter. Computers have many ports for transferring data and some are
* commonly used so be sure to not select one of these. For example, web
* servers usually use port 80 and POP mail uses port 110.
*
* ( end auto-generated )
* @webref net
* @usage application
* @brief The server class is used to create server objects which send and receives data to and from its associated clients (other programs connected to it).
* @instanceName server any variable of type Server
*/
publicclassServerimplementsRunnable {
PAppletparent;
MethodserverEventMethod;
Threadthread;
ServerSocketserver;
intport;
/** Number of clients currently connected. */
publicintclientCount;
/** Array of client objects, useful length is determined by clientCount. */
publicClient[] clients;
/**
* @param parent typically use "this"
* @param port port used to transfer data
*/
publicServer(PAppletparent, intport) {
this(parent, port, null);
}
/**
* @param parent typically use "this"
* @param port port used to transfer data
* @param host when multiple NICs are in use, the ip (or name) to bind from