+++ /dev/null
-#! /usr/bin/env python\r
-\r
-# Remote python client.\r
-# Execute Python commands remotely and send output back.\r
-\r
-import sys\r
-import string\r
-from socket import *\r
-\r
-PORT = 4127\r
-BUFSIZE = 1024\r
-\r
-def main():\r
- if len(sys.argv) < 3:\r
- print "usage: rpython host command"\r
- sys.exit(2)\r
- host = sys.argv[1]\r
- port = PORT\r
- i = string.find(host, ':')\r
- if i >= 0:\r
- port = string.atoi(port[i+1:])\r
- host = host[:i]\r
- command = string.join(sys.argv[2:])\r
- s = socket(AF_INET, SOCK_STREAM)\r
- s.connect((host, port))\r
- s.send(command)\r
- s.shutdown(1)\r
- reply = ''\r
- while 1:\r
- data = s.recv(BUFSIZE)\r
- if not data: break\r
- reply = reply + data\r
- print reply,\r
-\r
-main()\r