Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.DataOutputStream;
- import java.io.InputStream;
- import java.net.ServerSocket;
- import java.net.Socket;
- public class Main {
- public static void main(String[] args) {
- try {
- int playerCount = args[0] == null ? 50000 : Integer.parseInt(args[0]);
- ServerSocket listenerSocket = new ServerSocket(43594);
- while (listenerSocket.isBound()) {
- Socket sock = listenerSocket.accept();
- InputStream is = sock.getInputStream();
- DataOutputStream dos = new DataOutputStream(sock.getOutputStream());
- if (is.read() == 16) {
- dos.writeShort(playerCount);
- dos.write(2);
- } else {
- System.out.println("Unsupported request");
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement