#!/usr/bin/env python
from twisted.internet.protocol import DatagramProtocol
import time
import sys                     
import datetime

class DomIka(DatagramProtocol):
 

   def datagramReceived(self, data, (host, port)):
      now =  datetime.datetime.now()
      print "%s (%d) -> received %r from %s:%d" % (now, time.time(), data, host, port)
      #sys.stdout.write("%d -> received %r from %s:%d" % (time.time(), data, host, port))
      sys.stdout.flush()



if __name__ == '__main__':
   from twisted.internet import reactor
   reactor.listenUDP(12080, DomIka())
   reactor.run()

