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

Method interact

tools/python-3.11.9-amd64/Lib/telnetlib.py:539–563  ·  view source on GitHub ↗

Interaction function, emulates a very dumb telnet client.

(self)

Source from the content-addressed store, hash-verified

537 return bool(selector.select(0))
538
539 def interact(self):
540 """Interaction function, emulates a very dumb telnet client."""
541 if sys.platform == "win32":
542 self.mt_interact()
543 return
544 with _TelnetSelector() as selector:
545 selector.register(self, selectors.EVENT_READ)
546 selector.register(sys.stdin, selectors.EVENT_READ)
547
548 while True:
549 for key, events in selector.select():
550 if key.fileobj is self:
551 try:
552 text = self.read_eager()
553 except EOFError:
554 print('*** Connection closed by remote host ***')
555 return
556 if text:
557 sys.stdout.write(text.decode('ascii'))
558 sys.stdout.flush()
559 elif key.fileobj is sys.stdin:
560 line = sys.stdin.readline().encode('ascii')
561 if not line:
562 return
563 self.write(line)
564
565 def mt_interact(self):
566 """Multithreaded version of interact()."""

Callers 1

testFunction · 0.45

Calls 10

mt_interactMethod · 0.95
read_eagerMethod · 0.95
writeMethod · 0.95
printFunction · 0.50
registerMethod · 0.45
selectMethod · 0.45
decodeMethod · 0.45
flushMethod · 0.45
encodeMethod · 0.45
readlineMethod · 0.45

Tested by

no test coverage detected