(root)/trunk/client.py - Редакция 4
Редакция 3 |
К новейшей редакции |
Авторство |
Сравнить с предыдущей |
Последнее изменение |
Открыть журнал
| 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("verlihub.org", 4111 , f)
reactor.run()
# this only runs if the module was *not* imported
if __name__ == '__main__':
main()