Eric V. Smith added the comment:
Assuming that you're unplugging the cable when the code is in the loop that
occurs after the line "self.pcPart.write(cmdx)", and also assuming that you
haven't turned on keepalives, then the behavior you see is expected.
You're just waiting to read some data,
xy zzy added the comment:
Cfrom class():
# see if we can connect to pcPart
try:
self.pcPart = telnetlib.Telnet(IP, PORT)
# clear the buffer
for i in range(10):
self.pcPart.write('\n')
r = self.pcPart.read_until
Eric V. Smith added the comment:
Can you post some example code?
I would not expect disconnecting the network cable to close any TCP
connections, unless you are transmitting data and/or you have keepalives turned
on.
--
nosy: +eric.smith
___
Pytho
New submission from xy zzy :
Using python's telnetlib I can connect and communicate with a device.
While the telnet session is active I can disconnect the network cable of the
device.
At this point, I would expect read_until() with a timeout to throw a
socket.error, EOFError or perhaps an IOE