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()
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()
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
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()