Skip to content

Instantly share code, notes, and snippets.

@ninowalker
Created December 20, 2014 19:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ninowalker/365a2e20044631ece650 to your computer and use it in GitHub Desktop.
Save ninowalker/365a2e20044631ece650 to your computer and use it in GitHub Desktop.
Mock Statsd
# Based on
# http://stackoverflow.com/questions/15734219/simple-python-udp-server-trouble-receiving-packets-from-clients-other-than-loca
import socket
UDP_IP = ""
UDP_PORT = 8125
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.bind((UDP_IP, UDP_PORT))
while True:
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
print "received message:", data.strip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment