Jump to content
ServerSocket listenSocket = new ServerSocket(8080);
Socket socket = listenSocket.accept();

DataInputStream dataIn = new DataInputStream(socket.getInputStream());

if (dataIn.readBool()) { System.out.println("Alive"); }
else { System.out.println("Dead"); }

socket.close()

Listen for boolean data (if player is alive)

Link to post
Share on other sites

Socket socket = new Socket(ip, 8080);

DataOutputStream out = new DataOutputStream(socket.getOutputStream());

if (Alive) { out.writeBool(true); }
else { out.writeBool(false); }

socket.close();

to send the alive data.

 

You should be able to modify this to send the rest.

Link to post
Share on other sites

13 minutes ago, spidsepttk said:

Socket socket = new Socket(ip, 8080);

DataOutputStream out = new DataOutputStream(socket.getOutputStream());

if (Alive) { out.writeBool(true); }
else { out.writeBool(false); }

socket.close();

to send the alive data.

 

You should be able to modify this to send the rest.

Thank you

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×