def establishClientTunnelConnection(clientId, destPort): newProgram = Program(destPort) if(newProgram.connect()): newClient = Client(clientId, newProgram) return newClient else: sys.stderr.write("\nCouldn't connect to local port at: " + str(int(destPort, 2))) return None
def addNewClientAndOpenConnection(client_ID, portNumber): global __ACTIVE_CLIENTS_IDS __ACTIVE_CLIENTS_IDS.append(client_ID) newLocalProgram = Program(portNumber) if(not newLocalProgram.connect()): print("\nError connecting to port: "+str(portNumber)) else: print("\nConnection opened port#: "+str(portNumber))