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   Server
   
Name  

stop()

   
Examples  
// Example by Tom Igoe 
 
// Bug note: stopping the server produces an unrecoverable error: 
// "java.net.SocketException: Socket closed 
//  at java.net.PlainSocketImpl.socketAccept(Native Method)" 
 
 
import processing.net.*; 
 
int port = 10002; 
boolean myServerRunning; 
Server myServer; 
 
void setup() 
{ 
  size(400, 400); 
  background(0); 
  myServerRunning = false; 
  println("Server Running:" + "\t" + myServerRunning); 
} 
 
void draw() { 
  // Nothing happening here, everything happens in mousePressed() 
} 
 
void mousePressed() 
{ 
  // If the mouse clicked the myServer changes status 
  println("click"); 
  if (myServerRunning) { 
    // N.B. This produces an error which kills the applet. 
    myServerRunning = false; 
    myServer.stop(); 
    myServer = null; 
  } 
  else { 
    myServer = new Server(this, port); // Starts a server on port 10002 
    myServerRunning = true; 
 
  } 
  background(0); 
  println("Server Status:" + "\t" + myServerRunning); 
} 
 

Description   Disconnects all clients and stops the server.
   
Syntax  
server.stop()
   
Parameters  
server   any variable of type Server

   
Returns   None
   
Usage   Web & Application
   
 
 






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








Creative Commons License
 
  Processing is an open project initiated by Ben Fry and Casey Reas  
  © Info  
">and 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.