while (true) {
line = _in.read();
print("" + line);
}
Thats where connected should be used.
Also, you're reading a byte not a line.
public int getGameCode() {
return 'W' << 24 |
'2' << 16 |
'B' << 8 |
'N' << 0;
}
Its more efficient jsut to store the result fo that, insted of figuring it out every time.
private static final PROD_W2BN = 0x5732424E //W2BN
login();
print("Logged in.");
!! OMG YOU SENT ONE PACKET AND POOF YOU'RE LOGGED IN!!!
Just had to rag on you about your naming.
public void login() {
if (connected) {
try {
send((byte)0x01); // Send login thingy
/*
code
*/
sendNow(authinfo);
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
1st, The 'Login thingy' is called the protocol byte. It tells the server what you want to do!
2nd, You have sendNow throw a IOException.. that okay, but then you have login() handle that! So you are sjtu going to go along as if no exception was thrown? Bad boy.
And seriously, don't be lazy, use the correct protocol!
Its alright, i just found out how to get over the first hurdle.
I copyed that stuff from javaop1.
Obviously not...
Learn what that 'stuff' is before you continue.
~-~(HDX)~-~