Client socket methods

To connect to a remote socket in one direction, we can use the connect() method by using the connect (host, port) format:

import socket

# a socket object is created for communication
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# now connect to the web server on port 80
client_socket.connect(("www.packtpub.com", 80))
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset