def send_message(self, message): """Attempt to send a message using the client and the test buffer In case of a socket error, fail and report the problem """ from simple_client import client response = '' try: response = client(message) except socket.error, e: if e.errno == 61: msg = "Error: {0}, is the server running?" self.fail(msg.format(e.strerror)) else: self.fail("Unexpected Error: {0}".format(str(e)))
def send_message(self, message, use_bytes=False): """Attempt to send a message using the client and the test buffer In case of a socket error, fail and report the problem """ response = '' if not use_bytes: from simple_client import client else: from simple_client import bytes_client as client print('\n!!!!!!! travelling through bytes client', file=sys.stderr) try: response = client(message) except socket.error as e: if e.errno == 61: msg = "Error: {0}, is the server running?" self.fail(msg.format(e.strerror)) else: self.fail("Unexpected Error: {0}".format(str(e))) return response