sock.bind(("127.0.0.1", 6011)) flag = [1, 1, 1, 1] IP = [6008, 6009, 6010, 6011] d = {5009: "giri", 5010: "hari"} def receiver(threadname, x): global sock while True: data, add = sock.recvfrom(1024) if not bss.check(data, add, flag): break sock.close() bss.initialise(4, 3) UDP_IP = "127.0.0.1" thread = threading.Thread(target=receiver, args=("Receive", 0)) thread.start() print("Enter data to be sent. Enter \"exit\" to exit") message = input() while message != "exit": bss.update() message = message.replace(" ", "~") message += " " for i in bss.timestamp: message += str(i) + "," message += " " + str(bss.my_index) message = message.encode('utf-8')
sock.bind(("127.0.0.1", 5010)) flag = [1, 1, 1] IP = [5008, 5009, 5010] d = {5009: "giri", 5010: "hari"} def receiver(threadname, x): global sock while True: data, add = sock.recvfrom(1024) if not bss.check(data, add, flag): break sock.close() bss.initialise(3, 2) UDP_IP = "127.0.0.1" thread = threading.Thread(target=receiver, args=("Receive", 0)) thread.start() print("Enter data to be sent. Enter \"exit\" to exit") message = input() while message != "exit": bss.update() message = message.replace(" ", "~") message += " " for i in bss.timestamp: message += str(i) + "," message += " " + str(bss.my_index) message = message.encode('utf-8')
sock.bind(("127.0.0.1", 6010)) flag = [1, 1, 1, 1] IP = [6008, 6009, 6010, 6011] d = {5009: "giri", 5010: "hari"} def receiver(threadname, x): global sock while True: data, add = sock.recvfrom(1024) if not bss.check(data, add, flag): break sock.close() bss.initialise(4, 2) UDP_IP = "127.0.0.1" thread = threading.Thread(target=receiver, args=("Receive", 0)) thread.start() print("Enter data to be sent. Enter \"exit\" to exit") message = input() while message != "exit": bss.update() message = message.replace(" ", "~") message += " " for i in bss.timestamp: message += str(i) + "," message += " " + str(bss.my_index) message = message.encode('utf-8')
sock.bind(("127.0.0.1", 7009)) flag = [1, 1, 1] IP = [7008, 7009, 7010] d = {7008: "hel", 7010: "lo"} def receiver(threadname, x): global sock while True: data, add = sock.recvfrom(1024) if not bss.check(data, add, flag): break sock.close() bss.initialise(3, 1) UDP_IP = "127.0.0.1" thread = threading.Thread(target=receiver, args=("Receive", 0)) thread.start() print("Enter data to be sent. Enter \"exit\" to exit") message = input() while message != "exit": bss.update() message = message.replace(" ", "~") message += " " for i in bss.timestamp: message += str(i) + "," message += " " + str(bss.my_index) message = message.encode('utf-8')
sock.bind(("127.0.0.1", 6009)) flag = [1, 1, 1, 1] IP = [6008, 6009, 6010, 6011] d = {5009: "giri", 5010: "hari"} def receiver(threadname, x): global sock while True: data, add = sock.recvfrom(1024) if not bss.check(data, add, flag): break sock.close() bss.initialise(4, 1) UDP_IP = "127.0.0.1" thread = threading.Thread(target=receiver, args=("Receive", 0)) thread.start() print("Enter data to be sent. Enter \"exit\" to exit") message = input() while message != "exit": bss.update() message = message.replace(" ", "~") message += " " for i in bss.timestamp: message += str(i) + "," message += " " + str(bss.my_index) message = message.encode('utf-8')
sock.bind(("127.0.0.1", 6008)) flag = [1, 1, 1, 1] IP = [6008, 6009, 6010, 6011] d = {5009: "giri", 5010: "hari"} def receiver(threadname, x): global sock while True: data, add = sock.recvfrom(1024) if not bss.check(data, add, flag): break sock.close() bss.initialise(4, 0) UDP_IP = "127.0.0.1" thread = threading.Thread(target=receiver, args=("Receive", 0)) thread.start() print("Enter data to be sent. Enter \"exit\" to exit") message = input() while message != "exit": bss.update() message = message.replace(" ", "~") message += " " for i in bss.timestamp: message += str(i) + "," message += " " + str(bss.my_index) message = message.encode('utf-8')
sock.bind(("10.0.0.1", 5008)) flag = [1, 1, 1] IP = ['10.0.0.1', '10.0.0.2', '10.0.0.3'] d = {'10.0.0.2': "giri", '10.0.0.3': "hari"} def receiver(threadname, x): global sock while True: data, add = sock.recvfrom(1024) if not bss.check(data, add, flag): break sock.close() bss.initialise(3, 0) UDP_PORT = 5008 thread = threading.Thread(target=receiver, args=("Receive", 0)) thread.start() print "Enter data to be sent. Enter \"exit\" to exit" message = raw_input() while message != "exit": bss.update() message = message.replace(" ", "~") message += " " for i in bss.timestamp: message += str(i) + "," message += " " + str(bss.my_index) for i in range(len(flag)): if i != bss.my_index and flag[i] == 1:
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind(("10.0.0.1",5008)) flag = [1,1,1] IP = ['10.0.0.1','10.0.0.2','10.0.0.3'] d = { '10.0.0.2' : "giri" , '10.0.0.3' : "hari"} def receiver(threadname,x): global sock while True: data , add = sock.recvfrom(1024) if not bss.check(data, add, flag): break sock.close() bss.initialise(3,0) UDP_PORT = 5008 thread = threading.Thread(target = receiver , args = ("Receive" ,0 )) thread.start() print "Enter data to be sent. Enter \"exit\" to exit" message=raw_input() while message!="exit": bss.update() message = message.replace(" " ,"~") message += " " for i in bss.timestamp: message += str(i) + "," message += " " + str(bss.my_index) for i in range(len(flag)): if i != bss.my_index and flag[i] == 1: