Esempio n. 1
0
def client(HOST, PORT, arr, result, i):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  # create TCP Socket
    s.connect((HOST, PORT))
    reliable.send(s, arr)
    res = pickle.loads(reliable.receive(s))
    # print(res)
    result[i] = res  # store the result in the mutable array
    s.close()
Esempio n. 2
0
def client(HOST, PORT, arr, result, i):
    '''it send to the server a partition of the original list'''
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((HOST, PORT))
    reliable.send(s, arr)
    res = pickle.loads(reliable.receive(s))
    #print(res)
    result[i] = res
    s.close()
Esempio n. 3
0
def server(HOST, PORT):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.bind((HOST, PORT))
    s.listen(1)
    print("waiting accept")
    conn, addr = s.accept()
    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    print("waiting for receive")
    myobject = pickle.loads(reliable.receive(conn))
    quickLast.quickSort(myobject, 0, len(myobject)-1)
    reliable.send(conn, myobject)
    conn.close
Esempio n. 4
0
def server(HOST, PORT):
    s = socket.socket(socket.AF_INET,
                      socket.SOCK_STREAM)  # create a TCP Server
    s.bind((HOST, PORT))
    s.listen(1)
    print('esperando accept')
    conn, addr = s.accept()
    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    print('esperando recv')
    object_ = pickle.loads(reliable.receive(conn))
    object_.sort()
    print(object_)
    reliable.send(conn, object_)
    conn.close()