Commit 4550b00c authored by Guido van Rossum's avatar Guido van Rossum

Fix bit rot: use sock.connect((host, port)) and allow 2nd cmd line

arg.
parent de77bc54
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment