diff options
author | Guido van Rossum <guido@python.org> | 1992-11-16 16:55:48 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1992-11-16 16:55:48 (GMT) |
commit | d3b0f38db5550750c779a390b284d77fa987f425 (patch) | |
tree | a022613712503790d91ce216b6569af2bf1bab45 | |
parent | bfef4a0873e9d19be84819eaad8b774d0d7b3d2e (diff) | |
download | cpython-d3b0f38db5550750c779a390b284d77fa987f425.zip cpython-d3b0f38db5550750c779a390b284d77fa987f425.tar.gz cpython-d3b0f38db5550750c779a390b284d77fa987f425.tar.bz2 |
Support default port.
-rwxr-xr-x | Demo/sockets/gopher.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Demo/sockets/gopher.py b/Demo/sockets/gopher.py index d06c78a..625697b 100755 --- a/Demo/sockets/gopher.py +++ b/Demo/sockets/gopher.py @@ -39,7 +39,9 @@ TAB = '\t' # Open a TCP connection to a given host and port def open_socket(host, port): - if type(port) == type(''): + if not port: + port = DEF_PORT + elif type(port) == type(''): port = string.atoi(port) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, port)) |