@@ -0,0 +1,1557 @@
+#!/usr/bin/env python%0A%0Aimport argparse%0Aimport sys%0A%0Aimport liuproto.endpoint%0Aimport liuproto.link%0Aimport liuproto.storage%0A%0A%0Aclass Range(object):%0A    def __init__(self, start, end):%0A        self.start = start%0A        self.end = end%0A        self.format = '%25d--%25d'%0A%0A    def __eq__(self, other):%0A        return self.start %3C= other %3C= self.end%0A%0A    def __str__(self):%0A        return (self.format %25 (self.start, self.end)) + ' inclusive'%0A%0A    def __repr__(self):%0A        return self.format %25 (self.start, self.end)%0A%0A%0Aif __name__ == '__main__':%0A    parser = argparse.ArgumentParser()%0A%0A    parser.add_argument(%0A        '-l', '--listen-address',%0A        type=str,%0A        help=%22The address upon which to listen.%22,%0A        default='0.0.0.0')%0A%0A    parser.add_argument(%0A        '-p', '--port',%0A        type=int,%0A        help=%22The port upon which to listen.%22,%0A        default=8888,%0A        choices=%5BRange(1, 65535)%5D)%0A%0A    parser.add_argument(%0A        '-x', '--xml',%0A        help=%22Produce output in XML format.%22,%0A        action='store_true'%0A    )%0A%0A    args = parser.parse_args()%0A%0A    storage = liuproto.storage.Session('server')%0A%0A    link = liuproto.link.NetworkServerLink(%0A        (args.listen_address, args.port),%0A        storage=storage)%0A    results = link.run_proto()%0A%0A    link.close()%0A%0A    if args.xml:%0A        print storage.xml%0A    else:%0A        for bit in results:%0A            if bit is None:%0A                continue%0A%0A            if bit:%0A                sys.stdout.write('1')%0A            else:%0A                sys.stdout.write('0')%0A%0A        sys.stdout.write(%22%5Cn%22)%0A

Create liuproto_server.py