code: def datagramReceived(self, datagram, address):
          
          def write(result):
              print "Writing %r" % result
              self.transport.write(result, address)
  
          d = self.d()
          #d.addCallbacks(write, log.err)
          d.addCallback(write)  # errors are silently ignored!
          d.callback(datagram)
docs: After receiving a datagram, generate the deferreds and add myself to it.