Created
October 21, 2011 22:20
-
-
Save joneskoo/1305130 to your computer and use it in GitHub Desktop.
UDP sender
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import socket | |
import sys | |
PREFIX = "PREFIX:" | |
HOST = '127.0.0.1' | |
PORT = 5555 | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
s.connect((HOST, PORT)) | |
with sys.stdin as f: | |
while True: | |
try: | |
s.send(PREFIX + f.readline()) | |
except socket.error: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment