MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / main

Function main

tools/python-3.11.9-amd64/Tools/demo/rpythond.py:19–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17BUFSIZE = 1024
18
19def main():
20 if len(sys.argv) > 1:
21 port = int(sys.argv[1])
22 else:
23 port = PORT
24 s = socket(AF_INET, SOCK_STREAM)
25 s.bind(('', port))
26 s.listen(1)
27 while True:
28 conn, (remotehost, remoteport) = s.accept()
29 with conn:
30 print('connection from', remotehost, remoteport)
31 request = b''
32 while True:
33 data = conn.recv(BUFSIZE)
34 if not data:
35 break
36 request += data
37 reply = execute(request.decode())
38 conn.send(reply.encode())
39
40def execute(request):
41 stdout = sys.stdout

Callers 1

rpythond.pyFile · 0.70

Calls 10

socketClass · 0.90
executeFunction · 0.70
printFunction · 0.50
bindMethod · 0.45
listenMethod · 0.45
acceptMethod · 0.45
recvMethod · 0.45
decodeMethod · 0.45
sendMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected