|
|
@ -3,12 +3,15 @@ import java.io.IOException; |
|
|
|
import java.net.ServerSocket; |
|
|
|
import java.net.Socket; |
|
|
|
import java.util.List; |
|
|
|
import java.util.concurrent.CopyOnWriteArrayList; |
|
|
|
|
|
|
|
public class ChatServer { |
|
|
|
private ServerSocket serverSocket; |
|
|
|
private List<ClientHandler> clients; |
|
|
|
|
|
|
|
public ChatServer(int port) { |
|
|
|
clients = new CopyOnWriteArrayList<>(); |
|
|
|
|
|
|
|
try { |
|
|
|
serverSocket = new ServerSocket(port); |
|
|
|
System.out.println("Started ChatServer on port " + port); |
|
|
|