private void updateConnected ( ) throws IOException { byte cid = in . readByte ( ) ; // Ensure the client id is the same if ( cid != clientId ) { return ; } for ( final ConnectionListener listener : listeners ) { listener . notifyConnectionEstablished ( Byte . valueOf ( clientId ) , clientName ) ; } // Read the client list final int clientsNumber = in . readByte ( ) ; for ( int i = 0 ; i < clientsNumber ; i ++ ) { cid = in . readByte ( ) ; final String cname = readString ( ) ; for ( final ConnectionListener listener : listeners ) { listener . notifyClientConnected ( Byte . valueOf ( cid ) , cname ) ; } } // Message of the day if has if ( in . available ( ) > 0 ) { final String motd = readString ( ) ; for ( final ConnectionListener listener : listeners ) { listener . notifyMessageOfTheDay ( motd ) ; } } // Send the last answer out . write ( NetworkMessageSystemId . CONNECTED ) ; out . write ( clientId ) ; out . flush ( ) ; Verbose . info ( "Client: Connected to the server !" ) ; }
Update the connected case .