Jump to content

python server-client program 

I get this error on the client program side only 

client program

 

import socket
c= socket.socket(socket.AF_INET, socket.SOCK_STREAM)
c.connect(('localhost', 50000))
c.sendall(b"hello world")
c.close()
print(c)

 

-> errorConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

 

server program

 

import socket
s = socket.socket()
host = socket.gethostname()
port = 50000
s.bind((host, port))
s.listen(5)
while True:
    c, addr = s.accept()
    print('Got connection from', addr)
    c.send('Thank you for connecting')
    c.close()

 

used many different ports same error 

tried turning the firewall off 

ran it as an administrator 

same error help please 

 

 

 

Link to comment
https://linustechtips.com/topic/963795-python-networking-server-client/
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×