What am I doing...
This commit is contained in:
parent
371efdf89c
commit
4fcd68fef5
@ -0,0 +1,4 @@
|
|||||||
|
package ch.unibas.dmi.dbis.cs108.Multiplayer.Server;
|
||||||
|
|
||||||
|
public class ClientHandler {
|
||||||
|
}
|
||||||
@ -3,18 +3,22 @@ package ch.unibas.dmi.dbis.cs108.Multiplayer.Server;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class Server {
|
public class Server {
|
||||||
|
|
||||||
int port = 42069;
|
private static final int gamePort = 42069;
|
||||||
|
private static int clientIndex = 0;
|
||||||
|
private HashMap<String, Integer> nameToIndex = new HashMap<>();
|
||||||
|
private HashMap<Integer, ClientHandler> indexToHandler = new HashMap<>();
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ServerSocket gameServer = new ServerSocket(42069);
|
ServerSocket gameServer = new ServerSocket(gamePort);
|
||||||
System.out.println("Waiting for a connection on Port 42069");
|
System.out.println("Waiting for a connection on Port 42069");
|
||||||
while(true) {
|
while(true) {
|
||||||
Socket connector = gameServer.accept();
|
Socket client = gameServer.accept();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
Reference in New Issue
Block a user