Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d3b0f38

Browse files
committed
Support default port.
1 parent bfef4a0 commit d3b0f38

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Demo/sockets/gopher.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939

4040
# Open a TCP connection to a given host and port
4141
def open_socket(host, port):
42-
if type(port) == type(''):
42+
if not port:
43+
port = DEF_PORT
44+
elif type(port) == type(''):
4345
port = string.atoi(port)
4446
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
4547
s.connect((host, port))

0 commit comments

Comments
 (0)