|
|
@ -4,25 +4,25 @@ import java.net.ServerSocket; |
|
|
|
import java.net.Socket; |
|
|
|
|
|
|
|
public class ChatServer { |
|
|
|
|
|
|
|
|
|
|
|
private ServerSocket serverSocket; |
|
|
|
|
|
|
|
|
|
|
|
public ChatServer(int port) { |
|
|
|
try { |
|
|
|
serverSocket = new ServerSocket(port); |
|
|
|
System.out.println("Started ChatServer on port " + port); |
|
|
|
|
|
|
|
Socket connectionToClient = serverSocket.accept(); |
|
|
|
|
|
|
|
System.out.println("Accepted new Client"); |
|
|
|
} |
|
|
|
catch (IOException e) { |
|
|
|
serverSocket = new ServerSocket(port); |
|
|
|
System.out.println("Started ChatServer on port " + port); |
|
|
|
|
|
|
|
Socket connectionToClient = serverSocket.accept(); |
|
|
|
|
|
|
|
System.out.println("Accepted new Client"); |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void broadcastMessage(String s) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|