示例#1
0
def main():
    address = FilePath(sys.argv[1])
    content = FilePath(sys.argv[2])

    if address.exists():
        raise SystemExit("Cannot listen on an existing path")

    if not content.isfile():
        raise SystemExit("Content file must exist")

    startLogging(sys.stdout)

    serverFactory = Factory()
    serverFactory.content = content
    serverFactory.protocol = SendFDProtocol

    port = reactor.listenUNIX(address.path, serverFactory)
    reactor.run()
示例#2
0
def main():
    address = FilePath(sys.argv[1])
    content = FilePath(sys.argv[2])

    if address.exists():
        raise SystemExit("Cannot listen on an existing path")

    if not content.isfile():
        raise SystemExit("Content file must exist")

    startLogging(sys.stdout)

    serverFactory = Factory()
    serverFactory.content = content
    serverFactory.protocol = SendFDProtocol

    reactor.listenUNIX(address.path, serverFactory)
    reactor.run()