Back to index

python3.2  3.2.2
Functions | Variables
rpythond Namespace Reference

Functions

def main
def execute

Variables

int PORT = 4127
int BUFSIZE = 1024

Function Documentation

def rpythond.execute (   request)

Definition at line 40 of file rpythond.py.

00040 
00041 def execute(request):
00042     stdout = sys.stdout
00043     stderr = sys.stderr
00044     sys.stdout = sys.stderr = fakefile = io.StringIO()
00045     try:
00046         try:
00047             exec(request, {}, {})
00048         except:
00049             print()
00050             traceback.print_exc(100)
00051     finally:
00052         sys.stderr = stderr
00053         sys.stdout = stdout
00054     return fakefile.getvalue()
00055 
00056 try:
    main()

Here is the call graph for this function:

Here is the caller graph for this function:

def rpythond.main ( void  )

Definition at line 19 of file rpythond.py.

00019 
00020 def main():
00021     if len(sys.argv) > 1:
00022         port = int(sys.argv[1])
00023     else:
00024         port = PORT
00025     s = socket(AF_INET, SOCK_STREAM)
00026     s.bind(('', port))
00027     s.listen(1)
00028     while True:
00029         conn, (remotehost, remoteport) = s.accept()
00030         print('connection from', remotehost, remoteport)
00031         request = b''
00032         while 1:
00033             data = conn.recv(BUFSIZE)
00034             if not data:
00035                 break
00036             request += data
00037         reply = execute(request.decode())
00038         conn.send(reply.encode())
00039         conn.close()

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 17 of file rpythond.py.

Definition at line 16 of file rpythond.py.