]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Support default port.
authorGuido van Rossum <guido@python.org>
Mon, 16 Nov 1992 16:55:48 +0000 (16:55 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 16 Nov 1992 16:55:48 +0000 (16:55 +0000)
Demo/sockets/gopher.py

index d06c78a831b6c8159745dace55d27f2a4d9635cb..625697b5e735c193dfcef1674c17371b5acac4bf 100755 (executable)
@@ -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))