Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
aaebe1c1
Kaydet (Commit)
aaebe1c1
authored
Eki 15, 2008
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
use bytes throughout telnetlib docs
üst
3de7fb86
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
32 deletions
+33
-32
telnetlib.rst
Doc/library/telnetlib.rst
+33
-32
No files found.
Doc/library/telnetlib.rst
Dosyayı görüntüle @
aaebe1c1
...
...
@@ -62,58 +62,58 @@ Telnet Objects
.. method:: Telnet.read_until(expected[, timeout])
Read until a given
string, *expected*, is encountered or until *timeout* seconds
have passed.
Read until a given
byte string, *expected*, is encountered or until *timeout*
seconds
have passed.
When no match is found, return whatever is available instead, possibly
the
empty
string. Raise :exc:`EOFError` if the connection is closed and no cooked data is
available.
When no match is found, return whatever is available instead, possibly empty
bytes. Raise :exc:`EOFError` if the connection is closed and no cooked data
is
available.
.. method:: Telnet.read_all()
Read all data until EOF; block until connection closed.
Read all data until EOF
as bytes
; block until connection closed.
.. method:: Telnet.read_some()
Read at least one byte of cooked data unless EOF is hit. Return ``
''`` if EOF is
hit. Block if no data is immediately available.
Read at least one byte of cooked data unless EOF is hit. Return ``
b''`` if
EOF is
hit. Block if no data is immediately available.
.. method:: Telnet.read_very_eager()
Read everything that can be without blocking in I/O (eager).
Raise :exc:`EOFError` if connection closed and no cooked data available.
Return
``''`` if no cooked data available otherwise. Do not block unless in the midst
of an IAC sequence.
Raise :exc:`EOFError` if connection closed and no cooked data available.
Return ``b''`` if no cooked data available otherwise. Do not block unless in
the midst
of an IAC sequence.
.. method:: Telnet.read_eager()
Read readily available data.
Raise :exc:`EOFError` if connection closed and no cooked data available.
Return
``''`` if no cooked data available otherwise. Do not block unless in the midst
of an IAC sequence.
Raise :exc:`EOFError` if connection closed and no cooked data available.
Return ``b''`` if no cooked data available otherwise. Do not block unless in
the midst
of an IAC sequence.
.. method:: Telnet.read_lazy()
Process and return data already in the queues (lazy).
Raise :exc:`EOFError` if connection closed and no data available. Return
``''``
if no cooked data available otherwise. Do not block unless in the midst of an
IAC sequence.
Raise :exc:`EOFError` if connection closed and no data available. Return
``b''`` if no cooked data available otherwise. Do not block unless in the
midst of an
IAC sequence.
.. method:: Telnet.read_very_lazy()
Return any data available in the cooked queue (very lazy).
Raise :exc:`EOFError` if connection closed and no data available. Return
``''``
if no cooked data available otherwise. This method never blocks.
Raise :exc:`EOFError` if connection closed and no data available. Return
``b''``
if no cooked data available otherwise. This method never blocks.
.. method:: Telnet.read_sb_data()
...
...
@@ -163,9 +163,9 @@ Telnet Objects
.. method:: Telnet.write(buffer)
Write a
string to the socket, doubling any IAC characters. This can block if the
connection is blocked. May raise :exc:`socket.error` if the connection is
closed.
Write a
byte string to the socket, doubling any IAC characters. This can
block if the connection is blocked. May raise :exc:`socket.error` if the
c
onnection is c
losed.
.. method:: Telnet.interact()
...
...
@@ -183,20 +183,21 @@ Telnet Objects
Read until one from a list of a regular expressions matches.
The first argument is a list of regular expressions, either compiled
(:class:`re.RegexObject` instances) or uncompiled (strings). The optional second
argument is a timeout, in seconds; the default is to block indefinitely.
(:class:`re.RegexObject` instances) or uncompiled (byte strings). The
optional second argument is a timeout, in seconds; the default is to block
indefinitely.
Return a tuple of three items: the index in the list of the first regular
expression that matches; the match object returned; and the
text read up till
and including the match.
expression that matches; the match object returned; and the
bytes read up
till
and including the match.
If end of file is found and no
text was read, raise :exc:`EOFError`. Otherwise,
when nothing matches, return ``(-1, None, text)`` where *text* is the text
received so far (may be the empty string
if a timeout happened).
If end of file is found and no
bytes were read, raise :exc:`EOFError`.
Otherwise, when nothing matches, return ``(-1, None, data)`` where *data* is
the bytes received so far (may be empty bytes
if a timeout happened).
If a regular expression ends with a greedy match (such as ``.*``) or if more
than one expression can match the same input, the results are
indeterministic,
and may depend on the I/O timing.
than one expression can match the same input, the results are
indeterministic,
and may depend on the I/O timing.
.. method:: Telnet.set_option_negotiation_callback(callback)
...
...
@@ -234,5 +235,5 @@ A simple example illustrating typical use::
tn.write(b"ls\n")
tn.write(b"exit\n")
print(tn.read_all())
print(tn.read_all()
.decode('ascii')
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment