import logging

from zeroservices import BaseService, ZeroMQMedium


class SnifferService(BaseService):

    def __init__(self, *args, **kwargs):
        super(SnifferService, self).__init__(*args, **kwargs)
        self.logger.setLevel(logging.ERROR)
        self.medium.logger.setLevel(logging.ERROR)

    def on_event(self, message_type, *args, **kwargs):
        print "[{}] {} {}".format(message_type, args, kwargs)


if __name__ == '__main__':
    sniffer = SnifferService('sniffer', ZeroMQMedium(port_random=True))
    sniffer.main()

@@ -9,16 +9,31 @@
 ogging%0A%0A
+import asyncio%0A
 from zer
@@ -53,27 +53,81 @@
 ort 
-BaseService, ZeroMQ
+ZeroMQMedium, BaseService%0Afrom zeroservices.discovery import UdpDiscovery
 Medi
@@ -434,17 +434,17 @@
    print
- 
+(
 %22%5B%7B%7D%5D %7B%7D
@@ -486,122 +486,304 @@
 rgs)
-%0A%0A%0Aif __name__ == '__main__':%0A    sniffer = SnifferService('sniffer', ZeroMQMedium(port_random=True))%0A    sniffer.
+)%0A        yield from asyncio.sleep(0.0000001)%0A%0A%0Adef main():%0A    loop = asyncio.get_event_loop()%0A    medium = ZeroMQMedium(loop, UdpDiscoveryMedium)%0A    sniffer = SnifferService('sniffer', medium)%0A    loop.run_until_complete(sniffer.start())%0A    loop.run_forever()%0A%0Aif __name__ == '__main__':%0A    
 main

Update the sniffer