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