def escape(self, data):
"""\
This generator function is for the user. All outgoing data has to be
properly escaped, so that no IAC character in the data stream messes up
the Telnet state machine in the server.
socket.sendall(escape(data))
"""
for byte in iterbytes(data):
if byte == IAC:
yield IAC
yield IAC
else:
yield byte
# - incoming data filter
评论列表
文章目录