Skip to content

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

@Frosty553

Description

@Frosty553

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions