Changeset 909facda262dc013459cbea7eccc28e873ecc80c
- Timestamp:
- 02/20/07 18:09:08 (6 years ago)
- Author:
- cgabriel <cgabriel@…>
- Children:
- 79b0b2ed1ba3fef1c251daef65de34147b2e4042
- Parents:
- 3ef9a50cda2feb999d0f7c2c0e403a37a28e16d5
- git-committer:
- cgabriel <cgabriel@…> (02/20/07 18:09:08)
- Message:
-
added UDP Echo service to allow server discovery
git-svn-id: https://labs.truelite.it/svn/octofuss/trunk@186 5a101938-5c21-0410-9b5a-a83d6f3706a9
- Location:
- daemons
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
re0c2a87
|
r909facd
|
|
| | 1 | 2007-02-20 Christopher R. Gabriel <cgabriel@truelite.it> |
| | 2 | |
| | 3 | * octofussd (EchoUDP): added an EchoUDP service to allow server |
| | 4 | discovery. |
| | 5 | |
-
|
r237936e
|
r909facd
|
|
| 13 | 13 | # |
| 14 | 14 | |
| | 15 | __netport = 13400 |
| 15 | 16 | |
| 16 | 17 | from twisted.application import internet, service |
| 17 | 18 | from twisted.internet import protocol, reactor, defer |
| | 19 | from twisted.internet.protocol import DatagramProtocol |
| 18 | 20 | from twisted.web import resource, server, static, xmlrpc |
| 19 | 21 | import time |
| … |
… |
|
| 82 | 84 | |
| 83 | 85 | |
| 84 | | |
| 85 | 86 | application = service.Application('octofussd') |
| 86 | 87 | |
| 87 | 88 | f = OctofussService() |
| 88 | 89 | |
| | 90 | # our server discovery stuff |
| | 91 | |
| | 92 | class EchoUDP(DatagramProtocol): |
| | 93 | def datagramReceived(self,datagram,address): |
| | 94 | self.transport.write(datagram,address) |
| | 95 | |
| 89 | 96 | serviceCollection = service.IServiceCollection(application) |
| 90 | 97 | |
| 91 | | internet.TCPServer(13400, server.Site(f.getResource()) |
| | 98 | reactor.listenUDP(__netport, EchoUDP()) |
| | 99 | internet.TCPServer(__netport, server.Site(f.getResource()) |
| 92 | 100 | ).setServiceParent(serviceCollection) |
| 93 | 101 | |