After working through some of the basic tutorials, I want my TCP/UDP client to exit with a code indicating whether it connected or not. The right way to return an exit code in Twisted is:
point = TCP4ClientEndpoint(reactor, "localhost", 1234)
d = connectProtocol(point, ClientProtocol())
reactor.run()
sys.exit(0)
Then, when the process terminates, it will exit with code 0 to indicate a normal termination. If the client instead times out instead of successfully connecting, how should it pass a value back to that can then be passed to sys.exit instead of the constant 0?