def initialise_ethernet(self): #Instantiate client/server dependant upon command line arguements. I am sure there is a more #pythonic way of doing this. if self.args.type=='S': self.ethernetinterface = socket_server.socket_server_command(self.args.HOST, int(self.args.PORT)) elif self.args.type=='C': try: print("Opening Client in data transfer Mode...") self.ethernetinterface = socket_client.socket_client_command(self.args.filepath[0], self.args.HOST,int(self.args.PORT)) #These exceptions should really never happen. except socket_client.InvalidHostClient as msg: print(msg) sys.exit(1) except socket_client.InvalidPortClient as msg: print(msg) sys.exit(1) else: raise InvalidArguementException("Rut roh shaggy. Somethings gone wrong...")
def initialisetestclient(self): print("Opening Client in testcommand mode") self.ethernetinterface = socket_client.socket_client_command(None, self.args.HOST,int(self.args.PORT), None, True)