Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String[] getServerInfos(String ip, int port){
- try{
- Socket socket = new Socket();
- socket.connect(new InetSocketAddress(ip, port), 1 * 1000);
- DataOutputStream out = new DataOutputStream(socket.getOutputStream());
- DataInputStream in = new DataInputStream(socket.getInputStream());
- out.write(0xFE);
- StringBuilder str = new StringBuilder();
- int b;
- while((b = in.read()) != -1){
- if(b != 0 && b > 16 && b != 255 && b != 23 && b != 24){
- str.append((char) b);
- }
- }
- String[] data = str.toString().split("§");
- socket.close();
- return data;
- }catch(Exception e){
- e.printStackTrace();
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement