def client_function(): print "Connecting to a server..." sys.stdout.write("Server?: ") host = stdin.readline().rstrip("\n") sys.stdout.write("Port?: ") port = stdin.readline().rstrip("\n") c = Client(host, int(port)) c.send_packet("hello!") sleep(.01) i = 0 #wait to get packetConfirm while i < 3: c.Loop() sleep(.1) i += 1
from ServerObj import ServerObj from Client import Client import sys from sys import stdin from time import sleep sys.stdout.write("Server?: ") host = stdin.readline().rstrip("\n") sys.stdout.write("Port?: ") port = stdin.readline().rstrip("\n") s = ServerObj(localaddr=(host, int(port))); sleep(1) c = Client(host, int(port)); c.send_packet("hello!"); c.Loop() s.update()