I want to establish a FTP connection to Windows server (let's say 10.20.30.50) I am using Python ftblib package
session = ftplib.FTP('10.20.30.40','admin','password@123')
file = open('download.jpg','rb') # file to send
session.storbinary('STOR download.jpg', file) # send the file
file.close() # close file and FTP
session.quit()
But I am getting the error
socket.error: [Errno 10061] No connection could be made because the target machine actively refused it
Traceback:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\ftplib.py", line 120, in __init__
self.connect(host)
File "C:\Python27\lib\ftplib.py", line 135, in connect
self.sock = socket.create_connection((self.host, self.port), self.timeout)
File "C:\Python27\lib\socket.py", line 571, in create_connection
raise err
socket.error: [Errno 10061] No connection could be made because the target machine actively refused it.
I tried telnet 10.20.30.40 8081
and it is successful.
I allow port 8081 for ftp. I open port by adding new inbound rules.
I tried several available solutions on Stack Overflow as well as other sites but they all are talking about to check the port. I do all the things but still no help.
Thanks