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

Function main

tools/python-3.11.9-amd64/Tools/demo/rpython.py:14–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12BUFSIZE = 1024
13
14def main():
15 if len(sys.argv) < 3:
16 print("usage: rpython host command")
17 sys.exit(2)
18 host = sys.argv[1]
19 port = PORT
20 i = host.find(':')
21 if i >= 0:
22 port = int(host[i+1:])
23 host = host[:i]
24 command = ' '.join(sys.argv[2:])
25 with socket(AF_INET, SOCK_STREAM) as s:
26 s.connect((host, port))
27 s.send(command.encode())
28 s.shutdown(SHUT_WR)
29 reply = b''
30 while True:
31 data = s.recv(BUFSIZE)
32 if not data:
33 break
34 reply += data
35 print(reply.decode(), end=' ')
36
37main()

Callers 1

rpython.pyFile · 0.70

Calls 11

socketClass · 0.90
printFunction · 0.50
exitMethod · 0.45
findMethod · 0.45
joinMethod · 0.45
connectMethod · 0.45
sendMethod · 0.45
encodeMethod · 0.45
shutdownMethod · 0.45
recvMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected