FAQ
 
 
Cover  \ Exhibition  \ Learning  \ Reference  \ Download  \ Discourse   
      Language \ Environment \ Libraries \ Comparison
 
   
   
Back  
   
  Reference for Processing (BETA) version 91+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.  
Class   Client
   
Name  

write()

   
Examples  
// Example by Tom Igoe 
 
// Creates a client that sends input to a server 
 
import processing.net.*; 
Client myClient; 
int clicks; 
 
void setup() { 
  // Connect to the local machine at port 10002. 
  // This example will not run if you haven't 
  // previously started a server on this port  
  myClient = new Client(this, "127.0.0.1", 10002); 
  // Say hello 
  myClient.write("Hi there"); 
} 
 
void mouseReleased() { 
  // Count the number of mouse clicks: 
  clicks++; 
  // Tell the server: 
  myClient.write("Mouse pressed " + clicks + " times.\n"); 
} 
 
void draw() { 
  // Change the background if the mouse is pressed 
  if (mousePressed) { 
    background(255); 
  } else { 
    background(0); 
  } 
} 
 

Description   Writes data to a server specified when constructing the client.
   
Syntax  
client.write(data)
   
Parameters  
client   any variable of type Client

data   bytes, chars, ints, bytes[], Strings: data to write

   
Returns   int
   
Usage   Web & Application
   
 
 






   
 
Updated: Fri Jul 15 16:41:09 PDT 2005
 
 








Creative Commons License
 
  Processing is an open project initiated by Ben Fry and Casey Reas  
  © Info  
d width="20" bgcolor="#000000" height="25">  f="http://www.reas.com">Casey Reas     © Info   nt> and Casey Reas     © Info   ource.org/cc/Notice" /> -->     Processing is an open project initiated by Ben Fry and Casey Reas     © Info   native file format.