Exemple #1
0
def get_status():
    # Initialize socket, message and send it
    client = connect_client_socket()
    instruction = {'mode': 'status'}
    data_string = pickle.dumps(instruction, -1)
    client.send(data_string)

    response = receive_data(client)
    return response
Exemple #2
0
    def change_state(instruction):
        # Initialize socket, message and send it
        client = connect_client_socket()
        instruction['mode'] = state
        instruction['func'] = None
        data_string = pickle.dumps(instruction, -1)
        client.send(data_string)

        # Receive message and print it
        response = receive_data(client)
        process_response(response)
Exemple #3
0
def execute_send(args):
    client = connect_client_socket()

    # Send new instruction to daemon
    instruction = {"mode": "send", "input": args["input"]}
    data_string = pickle.dumps(instruction, -1)
    client.send(data_string)

    # Receive Answer from daemon and print it
    response = receive_data(client)
    process_response(response)
Exemple #4
0
def execute_add(args):
    client = connect_client_socket()

    # Send new instruction to daemon
    instruction = {"mode": "add", "command": args["command"], "path": os.getcwd()}
    data_string = pickle.dumps(instruction, -1)
    client.send(data_string)

    # Receive Answer from daemon and print it
    response = receive_data(client)
    process_response(response)