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 """ try: client(message, self.log) 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): """Attempt to send a message using the client In case of a socket error, fail and report the problem """ try: reply = client(message) except (socket.error, ConnectionRefusedError) 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 reply