Reference for Processing version 1.1+. 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.
	
		| Name | Client | 
	
		| Examples | import processing.net.*; 
Client myClient; 
int dataIn; 
 
void setup() { 
  size(200, 200); 
  // Connect to the local machine at port 5204.
  // This example will not run if you haven't
  // previously started a server on this port
  myClient = new Client(this, "127.0.0.1", 5204); 
} 
 
void draw() { 
  if (myClient.available() > 0) { 
    dataIn = myClient.read(); 
  } 
  background(dataIn); 
} | 
	
		| Description | A client connects to a server and sends data back and forth. If anything goes wrong with the connection, for example the host is not there or is listening on a different port, an exception is thrown. | 
	
		| Methods | 
	
		| available() | Returns the number of bytes in the buffer waiting to be read |  
		| read() | Returns a value from the buffer |  
		| readChar() | Returns the next byte in the buffer as a char |  
		| readBytes() | Reads everything in the buffer |  
		| readBytesUntil() | Reads from the buffer of bytes up to and including a particular character |  
		| readString() | Returns the buffer as a String |  
		| readStringUntil() | Returns the buffer as a String up to and including a particular character |  
		| write() | Writes bytes, chars, ints, bytes[], Strings |  
		| clear() | Clears the buffer |  
		| stop() | Disconnects from the server |  
		| ip() | Returns the IP address of the machine as a String |  | 
	
		| Constructor | Client(parent, host, port)
Client(parent, socket) | 
	
		| Parameters | 
	
		| parent | PApplet: typically use "this" |  
		| host | String: address of the server |  
		| port | int: port to read/write from on the server |  
		| socket | Socket: |  | 
	
		| Usage | Application | 
Updated on June 14, 2010 12:05:29pm EDT