def METHOD_NAME():
    def send(e):
        if connection is None:
            return
        try:
            connection.send(bytes(e, "utf-8"))
            self.data_channel(f"<-- {str(e)}")
        except (ConnectionAbortedError, ConnectionResetError):
            connection.close()
        except OSError:
            # Connection is likely already closed.
            if connection is not None:
                connection.close()
    recv = self.context.channel(f"{self.name}/recv", pure=True)
    send_channel_name = f"{self.name}/send"
    self.context.channel(send_channel_name, pure=True).watch(send)
    while self.state != "terminate":
        try:
            data_from_socket = connection.recv(1024)
            if len(data_from_socket):
                self.data_channel(f"--> {str(data_from_socket)}")
            else:
                break
            recv(data_from_socket)
        except socket.timeout:
            self.events_channel(
                _("Connection to {address} timed out.").format(address=address)
            )
            break
        except OSError:
            if connection is not None:
                connection.close()
            break
    self.context.channel(send_channel_name).unwatch(send)
    self.events_channel(
        _("Connection to {address} was closed.").format(address=address)
    )