From: Guido van Rossum Date: Mon, 16 Nov 1992 16:55:48 +0000 (+0000) Subject: Support default port. X-Git-Tag: v0.9.8~91 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d3b0f38db5550750c779a390b284d77fa987f425;p=thirdparty%2FPython%2Fcpython.git Support default port. --- diff --git a/Demo/sockets/gopher.py b/Demo/sockets/gopher.py index d06c78a831b6..625697b5e735 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))