def main():
try:<EOL><INDENT>ip = sys.argv[<NUM_LIT:1>]<EOL>port = int(sys.argv[<NUM_LIT:2>])<EOL><DEDENT>except (IndexError, ValueError):<EOL><INDENT>print('<STR_LIT>'.format(sys.argv[<NUM_LIT:0>]))<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)<EOL>server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, <NUM_LIT:1>)<EOL>server.bind((ip, port))<EOL>server.listen(<NUM_LIT:0>)<EOL>try:<EOL><INDENT>while True:<EOL><INDENT>print('<STR_LIT>')<EOL>(stream, addr) = server.accept()<EOL>print('<STR_LIT>'.format(addr[<NUM_LIT:0>], addr[<NUM_LIT:1>]))<EOL>handle_connection(stream)<EOL>stream.shutdown(socket.SHUT_WR)<EOL>stream.close()<EOL><DEDENT><DEDENT>except KeyboardInterrupt:<EOL><INDENT>print('<STR_LIT>')<EOL><DEDENT>
Run the server.