Skip to content

Instantly share code, notes, and snippets.

@zpoley
Created April 8, 2010 05:51
Show Gist options
  • Save zpoley/359819 to your computer and use it in GitHub Desktop.
Save zpoley/359819 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
from socket import *
import time
import subprocess
SERVER = "localhost"
PORT = 27072
# start udps UDP server
p = subprocess.Popen(["./udps"])
# give the udps server 1 second to ready
time.sleep(1)
s = socket(AF_INET, SOCK_DGRAM)
s.sendto("test 1", (SERVER, PORT))
print "udps.log contents:\n"
subprocess.call(["cat", "udps.log"])
print "\nkill ./udps udp server"
subprocess.Popen.kill(p)
print "\ndelete udps log test"
subprocess.call(["rm", "udps.log"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment