from socket import * mysock = socket(AF_INET, SOCK_DGRAM) mysock.bind(('', 7000)) clients = [] while 1: data, fromAddress = mysock.recvfrom(65536) known = False for c in clients: if c != fromAddress: mysock.sendto(data, c) else: known = True if not known: clients.append(fromAddress) print 'new client:', fromAddress