Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pcl-expect
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Per Cederqvist
pcl-expect
Commits
05338ec8
Commit
05338ec8
authored
21 years ago
by
Per Cederqvist
Browse files
Options
Downloads
Patches
Plain Diff
Documentation added.
parent
973a67d9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pcl_expect/telnet.py
+11
-0
11 additions, 0 deletions
pcl_expect/telnet.py
with
11 additions
and
0 deletions
pcl_expect/telnet.py
+
11
−
0
View file @
05338ec8
"""
Connect to a telnet server via the telnetlib.Telnet class.
"""
import
telnetlib
import
telnetlib
import
pcl_expect
import
pcl_expect
...
@@ -8,6 +11,12 @@ __all__ = [
...
@@ -8,6 +11,12 @@ __all__ = [
class
Telnet
(
pcl_expect
.
Expectable
):
class
Telnet
(
pcl_expect
.
Expectable
):
def
__init__
(
self
,
host
,
port
):
def
__init__
(
self
,
host
,
port
):
"""
Establish a telnet session.
The host and port argument are passed to telnetlib.Telnet.
"""
self
.
telnet
=
telnetlib
.
Telnet
(
host
,
port
)
self
.
telnet
=
telnetlib
.
Telnet
(
host
,
port
)
pcl_expect
.
Expectable
.
__init__
(
self
,
self
.
telnet
.
fileno
())
pcl_expect
.
Expectable
.
__init__
(
self
,
self
.
telnet
.
fileno
())
...
@@ -19,9 +28,11 @@ class Telnet(pcl_expect.Expectable):
...
@@ -19,9 +28,11 @@ class Telnet(pcl_expect.Expectable):
return
s
,
False
return
s
,
False
def
send
(
self
,
s
):
def
send
(
self
,
s
):
"""
Send a string to the remote telnet server.
"""
self
.
telnet
.
write
(
s
)
self
.
telnet
.
write
(
s
)
def
close
(
self
):
def
close
(
self
):
"""
Close the telnet session.
"""
pcl_expect
.
Expectable
.
close
(
self
)
pcl_expect
.
Expectable
.
close
(
self
)
self
.
telnet
.
close
()
self
.
telnet
.
close
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment