import java.net.*;
import java.io.*;
import classes.Adress;
import classes.Client;
import classes.ServerUserList;
/*
* Server class - register clients
*
* **/
public class Server {
public static void main(String[] ar) throws IOException {
//Connection adresses
Adress _connAdress = new Adress(6000,"127.0.0.2");
//Server interaction
ServerUserList _sui = new ServerUserList();
//Print connections params
//System.out.println("Server: connection's params ");
//_connAdress.printInfo();
ServerSocket _servSocket = new ServerSocket(_connAdress.getPort());
System.out.println("Server: server started");
try {
while (true) {
Socket _socket = _servSocket.accept();
try {
_sui.add(new Client(_socket,_sui));
}
catch (IOException e) {
_socket.close();
}
}
}
finally {
_servSocket.close();
}
}
}