def read_directory_direct_message(socket):
    logging.info("Sending directory direct message")

    response = socket.recv(BUFFER_SIZE)
    message = msg.create_message_obj(response)

    assert isinstance(message, msg.Direct)

    logging.info("Sending directory direct message finished")

    return message
def read_directory_direct_message(socket):
    logging.info("Sending directory direct message")

    response = socket.recv(BUFFER_SIZE)
    message = msg.create_message_obj(response)

    assert isinstance(message, msg.Direct)

    logging.info("Sending directory direct message finished")

    return message
def read_confirmation_message(file_name, socket):
    logging.info("Reading confirmation message: " + file_name)

    response = socket.recv(BUFFER_SIZE)

    message = msg.create_message_obj(response)

    logging.info("Confirmation Message:\n" + response)

    assert isinstance(message, msg.Confirm)

    logging.info("Reading confirmation message finished: " + file_name)
def read_confirmation_message(file_name, socket):
    logging.info("Reading confirmation message: " + file_name)

    response = socket.recv(BUFFER_SIZE)

    message = msg.create_message_obj(response)

    logging.info("Confirmation Message:\n" + response)

    assert isinstance(message, msg.Confirm)

    logging.info("Reading confirmation message finished: " + file_name)
def read_upload_response_message(file_name, socket):
    logging.info("Reading response: " + file_name)

    response = socket.recv(BUFFER_SIZE)

    message = msg.create_message_obj(response)

    logging.info("Upload Response:\n" + response)

    assert isinstance(message, msg.Upload)

    logging.info("Reading response finished: " + file_name)

    return message
def read_upload_response_message(file_name, socket):
    logging.info("Reading response: " + file_name)

    response = socket.recv(BUFFER_SIZE)

    message = msg.create_message_obj(response)

    logging.info("Upload Response:\n" + response)

    assert isinstance(message, msg.Upload)

    logging.info("Reading response finished: " + file_name)

    return message
Beispiel #7
0
    def handle_message(self):
        # print self.data
        message = msg.create_message_obj(self.data)

        if isinstance(message, msg.Download):
            logging.info("Processing Download Request: " + message.file_name)
            self.send_file(message.file_name, abs_directory_path)
            logging.info("Processing Download Request finished: " +
                         message.file_name)

        elif isinstance(message, msg.Upload):
            logging.info("Processing Upload Request: " + message.file_name)
            self.store_file(message.file_name, message.file_size)
            logging.info("Processing Upload Request finished: " +
                         message.file_name)

        else:
            self.request.sendall("Unrecognised message:\n" + self.data)
    def handle_message(self):
        # print self.data
        message = msg.create_message_obj(self.data)

        if isinstance(message, msg.Download):
            logging.info("Processing Download Request: " + message.file_name)
            self.send_file(message.file_name, abs_directory_path)
            logging.info("Processing Download Request finished: " +
                         message.file_name)

        elif isinstance(message, msg.Upload):
            logging.info("Processing Upload Request: " + message.file_name)
            self.store_file(message.file_name, message.file_size)
            logging.info("Processing Upload Request finished: " +
                         message.file_name)

        else:
            self.request.sendall("Unrecognised message:\n" + self.data)
Beispiel #9
0
    def handle_message(self):
        socket = self.request

        message = msg.create_message_obj(self.data)

        if isinstance(message, msg.Connect):
            logging.info("Processing Connect Request: " + message.file_name)

            file_name = message.file_name

            file_server = self.get_file_server_by_file_name(file_name)

            direct_message = msg.create_directory_direct_message(
                file_server.host, file_server.port, file_name)

            socket.sendall(direct_message)

            logging.info("Processing Connect Request finished: " +
                         message.file_name)

        else:
            self.request.sendall("Unrecognised message:\n" + self.data)
    def handle_message(self):
        socket = self.request

        message = msg.create_message_obj(self.data)

        if isinstance(message, msg.Connect):
            logging.info("Processing Connect Request: " + message.file_name)

            file_name = message.file_name

            file_server = self.get_file_server_by_file_name(file_name)

            direct_message = msg.create_directory_direct_message(
                file_server.host, file_server.port, file_name
            )

            socket.sendall(direct_message)

            logging.info("Processing Connect Request finished: " +
                         message.file_name)

        else:
            self.request.sendall("Unrecognised message:\n" + self.data)