Constructor. When called without arguments, create an unconnected instance. With a hostname argument, it connects the instance; port number and timeout are optional.
(self, host=None, port=0,
timeout=socket._GLOBAL_DEFAULT_TIMEOUT)
| 197 | """ |
| 198 | |
| 199 | def __init__(self, host=None, port=0, |
| 200 | timeout=socket._GLOBAL_DEFAULT_TIMEOUT): |
| 201 | """Constructor. |
| 202 | |
| 203 | When called without arguments, create an unconnected instance. |
| 204 | With a hostname argument, it connects the instance; port number |
| 205 | and timeout are optional. |
| 206 | """ |
| 207 | self.debuglevel = DEBUGLEVEL |
| 208 | self.host = host |
| 209 | self.port = port |
| 210 | self.timeout = timeout |
| 211 | self.sock = None |
| 212 | self.rawq = b'' |
| 213 | self.irawq = 0 |
| 214 | self.cookedq = b'' |
| 215 | self.eof = 0 |
| 216 | self.iacseq = b'' # Buffer for IAC sequence. |
| 217 | self.sb = 0 # flag for SB and SE sequence. |
| 218 | self.sbdataq = b'' |
| 219 | self.option_callback = None |
| 220 | if host is not None: |
| 221 | self.open(host, port, timeout) |
| 222 | |
| 223 | def open(self, host, port=0, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): |
| 224 | """Connect to a host. |