Back to index

python3.2  3.2.2
Functions | Variables
rpython Namespace Reference

Functions

def main

Variables

int PORT = 4127
int BUFSIZE = 1024

Function Documentation

def rpython.main ( void  )

Definition at line 14 of file rpython.py.

00014 
00015 def main():
00016     if len(sys.argv) < 3:
00017         print("usage: rpython host command")
00018         sys.exit(2)
00019     host = sys.argv[1]
00020     port = PORT
00021     i = host.find(':')
00022     if i >= 0:
00023         port = int(port[i+1:])
00024         host = host[:i]
00025     command = ' '.join(sys.argv[2:])
00026     s = socket(AF_INET, SOCK_STREAM)
00027     s.connect((host, port))
00028     s.send(command.encode())
00029     s.shutdown(SHUT_WR)
00030     reply = b''
00031     while True:
00032         data = s.recv(BUFSIZE)
00033         if not data:
00034             break
00035         reply += data
00036     print(reply.decode(), end=' ')
00037     s.close()
00038 
00039 main()

Variable Documentation

Definition at line 12 of file rpython.py.

int rpython.PORT = 4127

Definition at line 11 of file rpython.py.