]> git.llucax.com Git - software/pymin.git/commitdiff
Add a small utility to send pymin commands.
authorLeandro Lucarella <llucax@gmail.com>
Mon, 12 Nov 2007 16:54:52 +0000 (13:54 -0300)
committerLeandro Lucarella <llucax@gmail.com>
Mon, 12 Nov 2007 16:54:52 +0000 (13:54 -0300)
send_command.py [new file with mode: 0755]

diff --git a/send_command.py b/send_command.py
new file mode 100755 (executable)
index 0000000..1533a83
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+import sys
+import socket
+
+s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+
+host = sys.argv[1]
+port = int(sys.argv[2])
+
+s.bind(('', port+1))
+
+s.sendto(sys.stdin.read(), 0, (host, port))
+
+print
+
+print s.recvfrom(4096)[0]
+