Subversion Repositories pytwidcpp

Rev

Rev 3 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

# -*- coding: utf-8 -*-
""" DC++ Networks Client"""

from twisted.internet import reactor, protocol
from nmdc import NMDCClientToHub

class NMDCFactory(protocol.ClientFactory):
    protocol=NMDCClientToHub

    def startedConnecting(self, connector):
        print "Started Connecting"
        pass

    def clientConnectionFailed(self, connector, reason):
        print "Connection Failed"
        reactor.stop()

    def clientConnectionLost(self, connector, reason):
        print "Connection Lost"
        reactor.stop()


# this connects the protocol to a server runing on port 8000
def main():
    f = NMDCFactory()
    reactor.connectTCP("verlihub.org", 4111 , f)
    reactor.run()

# this only runs if the module was *not* imported
if __name__ == '__main__':
    main()