-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClient.java
30 lines (29 loc) · 945 Bytes
/
Client.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.util.Scanner
public class Client {
public static void main(String args[]) {
InetAddress inet = InetAddress.getByName(localhost);
System.out.println(inet.getHostAddress());
String eingabe;
boolean Playerfound = false;
Socket clientSocket = new Socket("localhost", 6789);
/**
* PvP
*/
if (Playerfound = true) {
System.out.println("Bitte wähle weise!\n 1: Schere \n 2: Stein\n 3: Papier");
DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());
BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
eingabe = inFromUser.readLine();
outToServer.writeBytes(eingabe + '\n');
Ergebnis = inFromServer.readLine();
System.out.println("Ergebnis: " + modifiedSentence);
}
/**
* PvC
*/
else {
System.out.println("Bitte wähle weise!\n 1: Schere \n 2: Stein\n 3: Papier");
}
clientSocket.close();
}
}