Language \ Environment \ Comparison
 
Index
 
  The Processing 1.0 _ALPHA_ Reference is a work in progress.
If you see any errors or have any comments, please write to: reas at groupc.net
Name  

endNet()

   
Examples  
int port = 5204; 
boolean server_running = true; 
int bgColor = 0; 
int direction = 1; 
 
void setup() 
{ 
  size(200, 200); 
  background(0); 
  // Starts a server on port 5204 
  beginNet(port); 	 
} 
 
public void mousePressed() 
{ 
  // If the mouse pressed stops the server 
  endNet(); 
  server_running = false; 
} 
 
void loop() 
{ 
  if(server_running == true) 
  { 
    netWrite(Integer.toString(bgColor)); 
    bgColor = bgColor + 1 * direction ; 
    if ((bgColor == 0) || (bgColor == 255)) { 
      direction *=-1; 
    } 
  } 
} 

Description   The endNet() function must be called to stop the network services. If it is called from a server application it stops the server, disconnecting all the connected clients and the network reading and writing activity related with them. If it is called from a client application it disconnects from the server and thus stops reading and writing activity. Once endNet() is called, you cannot use netWrite() and the net variable.
   
Syntax  
endNet()
   
Returns   None
   
Usage   Application
   
Related   beginNet()
netWrite()
netEvent()
net
   
© 2003- 2001 Massachusetts Institute of Technology and Interaction Design Institute Ivrea
Processing is an open project initiated by Ben Fry and Casey Reas