public synchronized OServerAdmin connect ( final String iUserName , final String iUserPassword ) throws IOException { storage . createConnectionPool ( ) ; storage . setSessionId ( - 1 ) ; try { final OChannelBinaryClient network = storage . beginRequest ( OChannelBinaryProtocol . REQUEST_CONNECT ) ; storage . sendClientInfo ( network ) ; try { network . writeString ( iUserName ) ; network . writeString ( iUserPassword ) ; } finally { storage . endRequest ( network ) ; } try { storage . beginResponse ( network ) ; sessionId = network . readInt ( ) ; storage . setSessionId ( sessionId ) ; } finally { storage . endResponse ( network ) ; } } catch ( Exception e ) { OLogManager . instance ( ) . error ( this , "Cannot connect to the remote server: " + storage . getName ( ) , e , OStorageException . class ) ; storage . close ( true ) ; } return this ; }
Connects to a remote server .