Reputation: 9
This is part of my code.
private static List<Client> clients = null;
public static boolean disconnectClient(Socket client)
{
try{
System.out.println("[SYSTEM] : " + client.getInetAddress().getHostAddress() + "was disconnected !!");
clients.remove(client);
return true;
}catch(Exception e){
e.printStackTrace();
return false;
}
}
if client disconnected call this function and print message
console : "[SYSTEM] : 127.0.0.1was disconnected !!"
but clients.size(); is return 1 (0 is answer...)
How can i fix it ?
Upvotes: 0
Views: 303
Reputation:
You are passing a socket object to remove (). But your list is consisted from Client objects. You should pass a client object instead.
Upvotes: 1