Skip to content

Instantly share code, notes, and snippets.

@mikeywaites
Created July 14, 2013 21:39
Show Gist options
  • Save mikeywaites/5996231 to your computer and use it in GitHub Desktop.
Save mikeywaites/5996231 to your computer and use it in GitHub Desktop.
import socket
UDP_IP = "127.0.0.1"
UDP_PORT = 9999
sock = socket.socket(socket.AF_INET,
socket.SOCK_DGRAM)
#this works
sock.sendto("{'ref': 'new ref'}", (UDP_IP, UDP_PORT))
#this fails
sock.sendto('{"ref": "new ref"}', (UDP_IP, UDP_PORT))
# This fails
sock.sendto(json.dumps({'test': 'hey hey'}), (UDP_IP, UDP_PORT))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment