Skip to content

Instantly share code, notes, and snippets.



Last active Aug 29, 2015
What would you like to do?
A handy Statsd trap that outputs all the incoming traffic to console
import socket, select
s1 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s1.bind(('localhost', 8125))
s2 = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_UDP)
s2.bind(('localhost', 8125))
while True:
r, w, x =[s1, s2], [], [])
for i in r:
print i, i.recvfrom(131072)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.