Iris/src/main/java/TcpServer.java
protected void runServer(){
        try{
            this.tcpServer = new ServerSocket( getPort() );                 // Create server
            setState( State.STARTED );                                      // Mark as started
            LOGGER.info("TCP Server established on port " + getPort() );
            
            while( !this.tcpServer.isClosed() ){
                synchronized( this ){
                    if( this.currentState == State.STOPPING ){
                        LOGGER.info( "Stopping TCP Server by request." );
                        this.tcpServer.close();
                    }   // end if: stopping
                }   // end sync
                
                if( !this.tcpServer.isClosed() ){
                    
                    ////////  B L O C K I N G
                    this.socket = this.tcpServer.accept();
                    ////////  B L O C K I N G
                    
                    if( LOGGER.isLoggable(Level.FINE) ){
                        LOGGER.fine( "TCP Server incoming socket: " + socket );
                    }
                    fireTcpServerSocketReceived();
                    
                }   //end if: not closed
            }   // end while: keepGoing
            
        } catch( Exception exc ){
            synchronized( this ){
                if( this.currentState == State.STOPPING ){  // User asked to stop
                    try{
                        this.tcpServer.close();
                        LOGGER.info( "TCP Server closed normally." );
                    } catch( IOException exc2 ){
                        LOGGER.log( 
                          Level.SEVERE,
                          "An error occurred while closing the TCP server. " +
                          "This may have left the server in an undefined state.",
                          exc2 );
                        fireExceptionNotification(exc2);
                    }   // end catch IOException
                } else {
                    LOGGER.log( Level.WARNING, "Server closed unexpectedly: " + exc.getMessage(), exc );
                }   // end else
            }   // end sync
            fireExceptionNotification(exc);
        } finally {
            setState( State.STOPPING );
            if( this.tcpServer != null ){
                try{
                    this.tcpServer.close();
                    LOGGER.info( "TCP Server closed normally." );
                } catch( IOException exc2 ){
                    LOGGER.log( 
                      Level.SEVERE,
                      "An error occurred while closing the TCP server. " +
                      "This may have left the server in an undefined state.",
                      exc2 );
                    fireExceptionNotification(exc2);
                }   // end catch IOException
            }   // end if: not null
            this.tcpServer = null;
        }
    }
/**
     * This method starts up and listens indefinitely
     * for TCP packets. On entering this method,
     * the state is assumed to be STARTING. Upon exiting
     * this method, the state will be STOPPING.
     */
This method starts up and listens indefinitely
for TCP packets. On entering this method,
the state is assumed to be STARTING. Upon exiting
this method, the state will be STOPPING.
This method starts up and listens indefinitely for TCP packets . On entering this method the state is assumed to be STARTING . Upon exiting this method the state will be STOPPING .
protected void runServer(){
        try{
            this.tcpServer = new ServerSocket( getPort() );                 
            setState( State.STARTED );                                      
            LOGGER.info("TCP Server established on port " + getPort() );
            while( !this.tcpServer.isClosed() ){
                synchronized( this ){
                    if( this.currentState == State.STOPPING ){
                        LOGGER.info( "Stopping TCP Server by request." );
                        this.tcpServer.close();
                    }   
                }   
                if( !this.tcpServer.isClosed() ){
                    this.socket = this.tcpServer.accept();
                    if( LOGGER.isLoggable(Level.FINE) ){
                        LOGGER.fine( "TCP Server incoming socket: " + socket );
                    }
                    fireTcpServerSocketReceived();
                }   
            }   
        } catch( Exception exc ){
            synchronized( this ){
                if( this.currentState == State.STOPPING ){  
                    try{
                        this.tcpServer.close();
                        LOGGER.info( "TCP Server closed normally." );
                    } catch( IOException exc2 ){
                        LOGGER.log( 
                          Level.SEVERE,
                          "An error occurred while closing the TCP server. " +
                          "This may have left the server in an undefined state.",
                          exc2 );
                        fireExceptionNotification(exc2);
                    }   
                } else {
                    LOGGER.log( Level.WARNING, "Server closed unexpectedly: " + exc.getMessage(), exc );
                }   
            }   
            fireExceptionNotification(exc);
        } finally {
            setState( State.STOPPING );
            if( this.tcpServer != null ){
                try{
                    this.tcpServer.close();
                    LOGGER.info( "TCP Server closed normally." );
                } catch( IOException exc2 ){
                    LOGGER.log( 
                      Level.SEVERE,
                      "An error occurred while closing the TCP server. " +
                      "This may have left the server in an undefined state.",
                      exc2 );
                    fireExceptionNotification(exc2);
                }   
            }   
            this.tcpServer = null;
        }
    }
protected void runServer ( ) { try { this . tcpServer = new ServerSocket ( getPort ( ) ) ; setState ( State . STARTED ) ; LOGGER . info ( "TCP Server established on port " + getPort ( ) ) ; while ( ! this . tcpServer . isClosed ( ) ) { synchronized ( this ) { if ( this . currentState == State . STOPPING ) { LOGGER . info ( "Stopping TCP Server by request." ) ; this . tcpServer . close ( ) ; } } if ( ! this . tcpServer . isClosed ( ) ) { this . socket = this . tcpServer . accept ( ) ; if ( LOGGER . isLoggable ( Level . FINE ) ) { LOGGER . fine ( "TCP Server incoming socket: " + socket ) ; } fireTcpServerSocketReceived ( ) ; } } } catch ( Exception exc ) { synchronized ( this ) { if ( this . currentState == State . STOPPING ) { try { this . tcpServer . close ( ) ; LOGGER . info ( "TCP Server closed normally." ) ; } catch ( IOException exc2 ) { LOGGER . log ( Level . SEVERE , "An error occurred while closing the TCP server. " + "This may have left the server in an undefined state." , exc2 ) ; fireExceptionNotification ( exc2 ) ; } } else { LOGGER . log ( Level . WARNING , "Server closed unexpectedly: " + exc . getMessage ( ) , exc ) ; } } fireExceptionNotification ( exc ) ; } finally { setState ( State . STOPPING ) ; if ( this . tcpServer != null ) { try { this . tcpServer . close ( ) ; LOGGER . info ( "TCP Server closed normally." ) ; } catch ( IOException exc2 ) { LOGGER . log ( Level . SEVERE , "An error occurred while closing the TCP server. " + "This may have left the server in an undefined state." , exc2 ) ; fireExceptionNotification ( exc2 ) ; } } this . tcpServer = null ; } }
This method starts up and listens indefinitely
 for TCP packets.
This method starts up and listens indefinitely for TCP packets .
// Create server // Mark as started // end if: stopping // end sync ////////  B L O C K I N G ////////  B L O C K I N G //end if: not closed // end while: keepGoing // User asked to stop // end catch IOException // end else // end sync // end catch IOException // end if: not null