| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="lib.html" title='Python Library Reference' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="module-urlparse.html" /> |
| 13 | <link rel="prev" href="module-smtpd.html" /> |
| 14 | <link rel="parent" href="internet.html" /> |
| 15 | <link rel="next" href="telnet-objects.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>11.14 telnetlib -- Telnet client</title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="11.13.4 MailmanProxy Objects" |
| 25 | href="node529.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="11. Internet Protocols and" |
| 28 | href="internet.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="11.14.1 Telnet Objects" |
| 31 | href="telnet-objects.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Python Library Reference</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 38 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="node529.html">11.13.4 MailmanProxy Objects</A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="internet.html">11. Internet Protocols and</A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="telnet-objects.html">11.14.1 Telnet Objects</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H1><A NAME="SECTION00131400000000000000000"> |
| 56 | 11.14 <tt class="module">telnetlib</tt> -- |
| 57 | Telnet client</A> |
| 58 | </H1> |
| 59 | |
| 60 | <P> |
| 61 | <A NAME="module-telnetlib"></A> |
| 62 | |
| 63 | <P> |
| 64 | <a id='l2h-3517' xml:id='l2h-3517'></a> |
| 65 | |
| 66 | <P> |
| 67 | The <tt class="module">telnetlib</tt> module provides a <tt class="class">Telnet</tt> class that |
| 68 | implements the Telnet protocol. See <a class="rfc" id='rfcref-90364' xml:id='rfcref-90364' |
| 69 | href="http://www.faqs.org/rfcs/rfc854.html">RFC 854</a> for details about the |
| 70 | protocol. In addition, it provides symbolic constants for the protocol |
| 71 | characters (see below), and for the telnet options. The |
| 72 | symbolic names of the telnet options follow the definitions in |
| 73 | <code>arpa/telnet.h</code>, with the leading <code>TELOPT_</code> removed. For |
| 74 | symbolic names of options which are traditionally not included in |
| 75 | <code>arpa/telnet.h</code>, see the module source itself. |
| 76 | |
| 77 | <P> |
| 78 | The symbolic constants for the telnet commands are: IAC, DONT, DO, |
| 79 | WONT, WILL, SE (Subnegotiation End), NOP (No Operation), DM (Data |
| 80 | Mark), BRK (Break), IP (Interrupt process), AO (Abort output), AYT |
| 81 | (Are You There), EC (Erase Character), EL (Erase Line), GA (Go Ahead), |
| 82 | SB (Subnegotiation Begin). |
| 83 | |
| 84 | <P> |
| 85 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 86 | <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-3516' xml:id='l2h-3516' class="class">Telnet</tt></b>(</nobr></td> |
| 87 | <td><var></var><big>[</big><var>host</var><big>[</big><var>, port</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt> |
| 88 | <dd> |
| 89 | <tt class="class">Telnet</tt> represents a connection to a Telnet server. The |
| 90 | instance is initially not connected by default; the <tt class="method">open()</tt> |
| 91 | method must be used to establish a connection. Alternatively, the |
| 92 | host name and optional port number can be passed to the constructor, |
| 93 | to, in which case the connection to the server will be established |
| 94 | before the constructor returns. |
| 95 | |
| 96 | <P> |
| 97 | Do not reopen an already connected instance. |
| 98 | |
| 99 | <P> |
| 100 | This class has many <tt class="method">read_*()</tt> methods. Note that some of them |
| 101 | raise <tt class="exception">EOFError</tt> when the end of the connection is read, |
| 102 | because they can return an empty string for other reasons. See the |
| 103 | individual descriptions below. |
| 104 | </dl> |
| 105 | |
| 106 | <P> |
| 107 | <div class="seealso"> |
| 108 | <p class="heading">See Also:</p> |
| 109 | |
| 110 | <dl compact="compact" class="seerfc"> |
| 111 | <dt><a href="http://www.faqs.org/rfcs/rfc854.html" |
| 112 | title="Telnet Protocol Specification" |
| 113 | >RFC 854, <em>Telnet Protocol Specification</em></a> |
| 114 | <dd> |
| 115 | Definition of the Telnet protocol. |
| 116 | </dl> |
| 117 | </div> |
| 118 | |
| 119 | <P> |
| 120 | |
| 121 | <p><br /></p><hr class='online-navigation' /> |
| 122 | <div class='online-navigation'> |
| 123 | <!--Table of Child-Links--> |
| 124 | <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a> |
| 125 | |
| 126 | <UL CLASS="ChildLinks"> |
| 127 | <LI><A href="telnet-objects.html">11.14.1 Telnet Objects</a> |
| 128 | <LI><A href="telnet-example.html">11.14.2 Telnet Example</a> |
| 129 | </ul> |
| 130 | <!--End of Table of Child-Links--> |
| 131 | </div> |
| 132 | |
| 133 | <DIV CLASS="navigation"> |
| 134 | <div class='online-navigation'> |
| 135 | <p></p><hr /> |
| 136 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 137 | <tr> |
| 138 | <td class='online-navigation'><a rel="prev" title="11.13.4 MailmanProxy Objects" |
| 139 | href="node529.html"><img src='../icons/previous.png' |
| 140 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 141 | <td class='online-navigation'><a rel="parent" title="11. Internet Protocols and" |
| 142 | href="internet.html"><img src='../icons/up.png' |
| 143 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 144 | <td class='online-navigation'><a rel="next" title="11.14.1 Telnet Objects" |
| 145 | href="telnet-objects.html"><img src='../icons/next.png' |
| 146 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 147 | <td align="center" width="100%">Python Library Reference</td> |
| 148 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 149 | href="contents.html"><img src='../icons/contents.png' |
| 150 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 151 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 152 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 153 | <td class='online-navigation'><a rel="index" title="Index" |
| 154 | href="genindex.html"><img src='../icons/index.png' |
| 155 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 156 | </tr></table> |
| 157 | <div class='online-navigation'> |
| 158 | <b class="navlabel">Previous:</b> |
| 159 | <a class="sectref" rel="prev" href="node529.html">11.13.4 MailmanProxy Objects</A> |
| 160 | <b class="navlabel">Up:</b> |
| 161 | <a class="sectref" rel="parent" href="internet.html">11. Internet Protocols and</A> |
| 162 | <b class="navlabel">Next:</b> |
| 163 | <a class="sectref" rel="next" href="telnet-objects.html">11.14.1 Telnet Objects</A> |
| 164 | </div> |
| 165 | </div> |
| 166 | <hr /> |
| 167 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 168 | </DIV> |
| 169 | <!--End of Navigation Panel--> |
| 170 | <ADDRESS> |
| 171 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 172 | </ADDRESS> |
| 173 | </BODY> |
| 174 | </HTML> |