예제 #1
0
파일: helper.py 프로젝트: Nukesor/pueue
def send_command(command):
    client = connect_client_socket()
    client.send(pickle.dumps(command, -1))
    answer = client.recv(1048576)
    response = pickle.loads(answer)
    client.close()
    return response
예제 #2
0
파일: displaying.py 프로젝트: Nukesor/pueue
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
예제 #3
0
파일: factories.py 프로젝트: Nukesor/pueue
    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)
예제 #4
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)
예제 #5
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)