Made Broadcast it's own file
This commit is contained in:
parent
695a901627
commit
f8698c13df
1 changed files with 16 additions and 0 deletions
16
Server/Broadcast.py
Normal file
16
Server/Broadcast.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
class Broadcast:
|
||||
def __init__(self):
|
||||
self.socks = []
|
||||
|
||||
def broadcast(self, data, exclude=[]):
|
||||
for sock in self.socks:
|
||||
if not sock in exclude:
|
||||
sock.send(data)
|
||||
|
||||
def remove(self, sock):
|
||||
if sock in self.socks:
|
||||
del self.socks[self.socks.index(sock)]
|
||||
|
||||
def add(self, sock):
|
||||
if not sock in self.socks:
|
||||
self.socks.append(sock)
|
Reference in a new issue