I am working on socket programming and I have to keep the track of all the clients that join the server.
So I am just keeping them an list:
client = []
and appending the client to it whenever they connect to the server. Now, I have to remove the client from the list whenever the client disconnects. The trouble is how can a server know if a client has disconnected from that server.
For connecting server, I am using:
s = socket.socket()
s.bind((host, port))
client = []
while True:
c, addr = s.accept()
client.append(addr)
s.close()