In python simple client program opens a connection to a given port 9876543 and given host. It is very simple to create a socket client using Python's socket module function. The socket.connect(hosname, port ) opens a TCP connection to hostname on the port. Once you have a socket open, you can read from it like any IO object.
use this code show in given below:
import socket # Import socket module
s = socket.socket() # Create a socket object
host = socket.gethostname() # Get local machine name
port = 9876543 # Reserve a port for your service.
s.connect((host, port))
print s.recv(1024)
s.close # Close the socket when done
1 Comment(s)