Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to create Simple Client in python

    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 559
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: