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))