Thread added into the array.
Which array?
Well this thread when user leave the
server want to make sure it not in used so that I can reuse it some
how or move into another array.
Sorry but it's hard to help if you don't provide enough background. Looks
like you're developing a game server; maybe this story is relevant to you:
http://comments.gmane.org/gmane.comp.python.general/627319
Assuming you're talking about TCP: when the client closes the connection
gracefully, you get an empty string '' when reading from the socket. If
the client loses the connection abruptly (the power goes down, the network
is broken, the process is killed...) you get no indication of that. You
may need to implement some mechanism (a PING? query/response, or perhaps
the client must send an "I'm alive!" message once each N minutes; no
answer means it's down and the server closes the connection).
Need to know the thread speed that need for game server timer to
control it. Don't want it too fast or slow for the game server.
fps = 30
def run(self):
while True:
self.gametime += 1
if self.gametime > 10000000/fps:
self.gametime = 0;
What's this code used for, apart from sucking lots of CPU power?