import argparse import socket from ot import bob from net import send, send_point, recv, recv_point import sys def main(): p = argparse.ArgumentParser() p.add_argument('c', type=int, help="Which message to choose? [0, 1]") p.add_argument('--ip', type=str, default='127.0.0.1') p.add_argument('-p', '--port', type=int, default=8080) args = p.parse_args() with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as alice: alice.connect((args.ip, args.port)) b = bob(args.c > 0) b.send(None) send_point(alice, b.send(recv_point(alice))) response = b.send(recv(alice)) sys.stdout.buffer.write(response) if __name__ == "__main__": main()