Changeset 909facda262dc013459cbea7eccc28e873ecc80c

Show
Ignore:
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:
2 modified

Legend:

Unmodified
Added
Removed
  • daemons/ChangeLog

    re0c2a87 r909facd  
     12007-02-20  Christopher R. Gabriel  <cgabriel@truelite.it> 
     2 
     3        * octofussd (EchoUDP): added an EchoUDP service to allow server  
     4        discovery. 
     5 
  • daemons/octofussd

    r237936e r909facd  
    1313#  
    1414 
     15__netport = 13400 
    1516 
    1617from twisted.application import internet, service 
    1718from twisted.internet import protocol, reactor, defer 
     19from twisted.internet.protocol import DatagramProtocol 
    1820from twisted.web import resource, server, static, xmlrpc 
    1921import time 
     
    8284 
    8385 
    84  
    8586application = service.Application('octofussd') 
    8687 
    8788f = OctofussService() 
    8889 
     90# our server discovery stuff 
     91 
     92class EchoUDP(DatagramProtocol): 
     93        def datagramReceived(self,datagram,address): 
     94                self.transport.write(datagram,address) 
     95 
    8996serviceCollection = service.IServiceCollection(application) 
    9097 
    91 internet.TCPServer(13400, server.Site(f.getResource()) 
     98reactor.listenUDP(__netport, EchoUDP()) 
     99internet.TCPServer(__netport, server.Site(f.getResource()) 
    92100                   ).setServiceParent(serviceCollection) 
    93101