こぴーあんどぺーすと

http://d.hatena.ne.jp/technolize/20070619#1182240002

ありがたくこぴーあんどぺーすとさせていただく。

from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor

class Echo(DatagramProtocol):
  def datagramReceived(self, data, (host, port)):
    print 'recived %r from %s:%d' % (data, host, port)
    self.transport.write(data, (host, port))

reactor.listenUDP(1812, Echo())
reactor.run()