/* Send to server a login request and indicate the game name and version */
netMan.addMessage(new MessageC2SLoginRequestKey(null, getGameName(), getVersionNumber()));
int timeout = TIMEOUT;
while (received < 3) {
Message msg = getMessage(timeout);
// Okay, now we know that there is a marauroa server responding to the handshake.
// We can give it more time for the next steps in case the database is slow.
// Loging heavily depends on the database because number of failed logins for both
// ip-address and username, banstatus, username&password have to be checked. And
// the list of characters needs to be loaded from the database.
timeout = TIMEOUT_EXTENDED;
switch (msg.getType()) {
case S2C_INVALIDMESSAGE: {
throw new LoginFailedException(((MessageS2CInvalidMessage) msg).getReason());
}
/* Server sends its public RSA key */
case S2C_LOGIN_SENDKEY: {