Хранилища Subversion pytwidcpp

Редакция

Редакция 4 | Авторство | Сравнить с предыдущей | Последнее изменение | Открыть журнал | RSS

# -*- 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("127.0.0.1", 31337 , f)
    reactor.run()

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