Хранилища Subversion pytwidcpp

Редакция

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

Редакция Автор № строки Строка
2 scream 1
# -*- coding: utf-8 -*-
2
""" DC++ Networks Client"""
3
 
4
from twisted.internet import reactor, protocol
5
from nmdc import NMDCClientToHub
6
 
7
class NMDCFactory(protocol.ClientFactory):
8
    protocol=NMDCClientToHub
9
 
10
    def startedConnecting(self, connector):
11
        print "Started Connecting"
12
        pass
13
 
14
    def clientConnectionFailed(self, connector, reason):
15
        print "Connection Failed"
16
        reactor.stop()
17
 
18
    def clientConnectionLost(self, connector, reason):
19
        print "Connection Lost"
20
        reactor.stop()
21
 
22
 
23
# this connects the protocol to a server runing on port 8000
24
def main():
25
    f = NMDCFactory()
6 scream 26
    reactor.connectTCP("127.0.0.1", 31337 , f)
2 scream 27
    reactor.run()
28
 
29
# this only runs if the module was *not* imported
30
if __name__ == '__main__':
31
    main()