Can you please tell me how to connect to the server in Java, for example on Battle.NET Alkar?

war3.alkar.net - Battle.NET server

6112 - port

pvpgn - bnet_cusnom_passwordhashtype

PS: provide for the output of auxiliary messages (for example: connecting to server, connected ).

  • 2
    Like a local network. Only the addresses differ - Anton Mukhin
  • Read about the Socket class. - cavinc
  • Extremely weird question. An example of a socket connection is given, but it seems to me that this is not what you are looking for. The question sounds like "please email me software" - Victor

1 answer 1

Connection code to the socket and receiving the message.

 try { Socket s = new Socket ("192.168.0.1", 8189); InputStream inStream = s.getInputStream(); Scanner in = new Scanner (inStream); while (in.hasNextLine()) { String line = in.nextLine(); } s.close(); } catch (IOException e) { e.printStackTrace(); }