diff options
author | Fred Drake <fdrake@acm.org> | 2000-04-03 20:13:55 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-04-03 20:13:55 (GMT) |
commit | 38e5d27caee56b6958e0034e342abb48e6100390 (patch) | |
tree | 6a0c853da853123dd2e628e8ec187517250c2530 /Doc/lib/libtelnetlib.tex | |
parent | 659ebfa79e891fc5e2480cd66c157970df57c451 (diff) | |
download | cpython-38e5d27caee56b6958e0034e342abb48e6100390.zip cpython-38e5d27caee56b6958e0034e342abb48e6100390.tar.gz cpython-38e5d27caee56b6958e0034e342abb48e6100390.tar.bz2 |
Merged changes from the 1.5.2p2 release.
(Very rough.)
Diffstat (limited to 'Doc/lib/libtelnetlib.tex')
-rw-r--r-- | Doc/lib/libtelnetlib.tex | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/Doc/lib/libtelnetlib.tex b/Doc/lib/libtelnetlib.tex index f28833e..de88953 100644 --- a/Doc/lib/libtelnetlib.tex +++ b/Doc/lib/libtelnetlib.tex @@ -1,12 +1,9 @@ -% LaTeX'ized from the comments in the module by Skip Montanaro -% <skip@mojam.com>. - \section{\module{telnetlib} --- Telnet client} \declaremodule{standard}{telnetlib} \modulesynopsis{Telnet client class.} - +\sectionauthor{Skip Montanaro}{skip@mojam.com} The \module{telnetlib} module provides a \class{Telnet} class that implements the Telnet protocol. See \rfc{854} for details about the @@ -149,3 +146,32 @@ If a regular expression ends with a greedy match (e.g. \regexp{.*}) or if more than one expression can match the same input, the results are undeterministic, and may depend on the I/O timing. \end{methoddesc} + + +\subsection{Telnet Example \label{telnet-example}} +\sectionauthor{Peter Funk}{pf@artcom-gmbh.de} + +A simple example illustrating typical use: + +\begin{verbatim} +import getpass +import sys +import telnetlib + +HOST = "localhost" +user = raw_input("Enter your remote account: ") +password = getpass.getpass() + +tn = telnetlib.Telnet(HOST) + +tn.read_until("login: ") +tn.write(user + "\n") +if password: + tn.read_until("Password: ") + tn.write(password + "\n") + +tn.write("ls\n") +tn.write("exit\n") + +print tn.read_all() +\end{verbatim} |