Ejemplo n.º 1
0
thread = Save(xml)
thread.start()

def save_data():
	xml.write()
	print 'saved'

while True:
	try:
		d = s.recvfrom(1024)
		data = d[0].split()
		addr = d[1]

		if addr[0] != current_ip:
			current_ip = str(addr[0])
			xml.set_ip_client(current_ip)
			sooper.set_connection(current_ip, current_port)
			print 'New ip: ' + current_ip
		
		if data:
			print 'Message received: ' + str(d[0])

			if data[0] == 'Connection':
				current_port = int(addr[1])
				xml.set_port_client(str(current_port))
				sooper.set_connection(current_ip, current_port)

				print 'New port: ' + str(current_port)

			elif data[0] == 'Set_All':
				for i in range(0, 5):