diff options
author | Guido van Rossum <guido@python.org> | 2000-12-14 22:12:33 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-12-14 22:12:33 (GMT) |
commit | 4550b00c80b064a3594d6d648fd7e164ffa59286 (patch) | |
tree | 70952cefe6608551fc5638f8854da55a951e4535 | |
parent | de77bc5468d59d023bce9ae3d41a116f22de951f (diff) | |
download | cpython-4550b00c80b064a3594d6d648fd7e164ffa59286.zip cpython-4550b00c80b064a3594d6d648fd7e164ffa59286.tar.gz cpython-4550b00c80b064a3594d6d648fd7e164ffa59286.tar.bz2 |
Fix bit rot: use sock.connect((host, port)) and allow 2nd cmd line
arg.
-rw-r--r-- | Demo/threads/telnet.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Demo/threads/telnet.py b/Demo/threads/telnet.py index f63d955..eacb06d 100644 --- a/Demo/threads/telnet.py +++ b/Demo/threads/telnet.py @@ -28,8 +28,8 @@ WONT = chr(252) WILL = chr(251) def main(): - if len(sys.argv) != 2: - sys.stderr.write('usage: telnet hostname\n') + if len(sys.argv) < 2: + sys.stderr.write('usage: telnet hostname [port]\n') sys.exit(2) host = sys.argv[1] try: @@ -55,7 +55,7 @@ def main(): s = socket(AF_INET, SOCK_STREAM) # try: - s.connect(host, port) + s.connect((host, port)) except error, msg: sys.stderr.write('connect failed: ' + `msg` + '\n') sys.exit(1) |