Skip to content
Snippets Groups Projects
Commit c86bbcca authored by Elrabu's avatar Elrabu
Browse files

Update: fixed spelling.

parent ff26037b
No related branches found
No related tags found
2 merge requests!35Update: Added more Stuff to be transported over the server.,!2Merge of Multiplayer Feature into development branch
...@@ -20,16 +20,17 @@ public class Client { ...@@ -20,16 +20,17 @@ public class Client {
in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
} }
public int sendMessage(int number) throws IOException { public int sendX(int number) throws IOException {
out.println(number); out.println(number);
return number; return number;
} }
public int receiveInt() throws IOException { public int sendY(int number) throws IOException {
String response = in.readLine(); out.println(number);
return Integer.parseInt(response); return number;
} }
public void stopConnection() throws IOException { public void stopConnection() throws IOException {
in.close(); in.close();
out.close(); out.close();
......
...@@ -9,9 +9,14 @@ public class ConnectionHandling { ...@@ -9,9 +9,14 @@ public class ConnectionHandling {
Client client = new Client(); Client client = new Client();
client.startConnection("localhost", 4444); client.startConnection("localhost", 4444);
for (int i = 0; i < 10; i++){ for (int i = 0; i < 10; i++){
int resp1 = client.sendMessage(1); int x = client.sendX(1);
System.out.println(resp1); System.out.println(x);
int y = client.sendX(0);
System.out.println(y);
TimeUnit.SECONDS.sleep(1); TimeUnit.SECONDS.sleep(1);
} }
} }
} }
...@@ -5,10 +5,12 @@ import java.io.*; ...@@ -5,10 +5,12 @@ import java.io.*;
public class Server { public class Server {
private ServerSocket serverSocket; private ServerSocket serverSocket;
private static BufferedReader px;
private static BufferedReader py;
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
Server server = new Server(); Server server = new Server();
server.start("lolcalhost",4444); server.start("localhost",4444);
} }
public void start(String lolcalhost, int port) throws IOException { public void start(String lolcalhost, int port) throws IOException {
...@@ -27,7 +29,7 @@ public class Server { ...@@ -27,7 +29,7 @@ public class Server {
private Socket clientSocket; private Socket clientSocket;
private PrintWriter out; private PrintWriter out;
private BufferedReader in; private BufferedReader in;
private static BufferedReader px;
public EchoClientHandler(Socket socket) { public EchoClientHandler(Socket socket) {
this.clientSocket = socket; this.clientSocket = socket;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment