Made Broadcast it's own file

This commit is contained in:
PhilipTrauner 2015-11-02 22:31:02 +01:00
parent 695a901627
commit f8698c13df

16
Server/Broadcast.py Normal file
View 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)