#!/usr/bin/env python3
# vim:ts=4:sts=4:sw=4:expandtab

import argparse
import pathlib
import socket
import sys

HOST = '57.128.228.10'
#HOST = '127.0.0.1'
PORT = 3333

parser = argparse.ArgumentParser(description='Shared State Sender')
parser.add_argument('--host', default=HOST)
parser.add_argument('--port', type=int, default=PORT)
args = parser.parse_args()

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as connection:
    try:
        connection.connect((args.host, args.port))
        while True:
            connection.send(b'?')
            sys.stdout.write(str(connection.recv(1), 'utf8'))
            sys.stdout.flush()
    finally:
        connection.close()
