daily pastebin goal
79%
SHARE
TWEET

Untitled

a guest May 19th, 2017 40 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.io.IOException;
  2. import java.net.Socket;
  3. import java.nio.ByteBuffer;
  4.  
  5. public class RSRevisionChecker {
  6.     private static int findRS2Revision() throws IOException {
  7.         int clientNo = 599;
  8.         boolean success = false;
  9.         ByteBuffer out = ByteBuffer.allocate(5);
  10.         while (!success) {
  11.             Socket socket = new Socket("world119.runescape.com", 43594);
  12.             out.put((byte) 15);
  13.             out.putInt(clientNo);
  14.             socket.getOutputStream().write(out.array(), 0, 5);
  15.             int rsp = socket.getInputStream().read();
  16.             if (rsp == 0) {
  17.                 success = true;
  18.             } else {
  19.                 socket.close();
  20.                 clientNo++;
  21.             }
  22.             out.clear();
  23.         }
  24.         return clientNo;
  25.     }
  26.     public static void main(String[] args) {
  27.         try {
  28.             System.out.println("Current RS Revision: "+findRS2Revision());
  29.         } catch (IOException e) {
  30.             e.printStackTrace();
  31.         }
  32.     }
  33. }
RAW Paste Data
Top