<s> from twisted . internet . protocol import DatagramProtocol <EOL> from twisted . internet import reactor <EOL> class MulticastPingPong ( DatagramProtocol ) : <EOL> def startProtocol ( self ) : <EOL> """<STR_LIT>""" <EOL> self . transport . setTTL ( <NUM_LIT:5> ) <EOL> self . transport . joinGroup ( "<STR_LIT>" ) <EOL> def datagramReceived ( self , datagram , address ) : <EOL> print "<STR_LIT>" % ( repr ( datagram ) , repr ( address ) ) <EOL> if datagram == "<STR_LIT>" : <EOL> self . transport . write ( "<STR_LIT>" , address ) <EOL> reactor . listenMulticast ( <NUM_LIT> , MulticastPingPong ( ) , <EOL> listenMultiple = True ) <EOL> reactor . run ( ) </s>
