Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WinError 10061] No connection could be made because the target machine actively refused it #271

Open
Frosty553 opened this issue Jul 23, 2021 · 2 comments

Comments

@Frosty553
Copy link

Hi, so I've been trying to code a file transfer program in python and it worked preety well on my pc (for now I only tested it with a txt file but I think it'll work with other files too), but the problem is when I tried running it on my brothers pc WinError 10061 popped up, I've done quite a bit of research before writing this and the common running the server before the client method doesn't work on my pc, I also tried turning off my antivirus thinking it blocked it but that didn't do anything either.
I don't really know what to do anymore so I came looking for help here. I hope somebody can help me

Here is the server program code:
import socket
s = socket.socket()
host = socket.gethostname()
port = 8080
s.bind((host,port))
s.listen(1)
print(host)
print("Waitning for any incoming connections ...")
conn, addr = s.accept()
print(addr, "Has connected to the server")

filename = input(str("Please enter the filename of the file : "))
file = open(filename , 'rb')
file_data = file.read(1024)
conn.send(file_data)
print("Data has been transmitted successfully")

And here is the client program code:
import socket
s = socket.socket()
host = input(str("Please enter the host adress of the sender : "))
port = 8080
s.connect((host,port))
print("Connected ... ")

filename = input(str("Please enter a filename for the incoming file : "))
file = open(filename, 'wb')
file_data = s.recv(1024)
file.write(file_data)
file.close()
print("File has been received successfully")

@Mart-Bogdan
Copy link

Why would you use server-side websocket on windows?)

@Mart-Bogdan
Copy link

I think issue is with windows firewall or program not being run as admin due to UAC. Try using another port, like 30155 or something other high enough (max port number is 65536)

does this error pops out on the server side of the app or on client-side?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants