4

I am using python FTP server and client program. My need is to run Python FTP server on a remote machine that is connected on the same network as my local machine. FTP client will run from local machine, I need to connect FTP server with my FTP client running on local machine.

Please help!

This is my ftpserver.py:

from pyftpdlib.servers import FTPServer
from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler

authorizer = DummyAuthorizer()
authorizer.add_user("lokesh", "123", "current_dir", perm="elradfmw")
authorizer.add_anonymous("curent_dir", perm="elradfmw")

handler = FTPHandler
handler.authorizer = authorizer

server=FTPServer(("localhost",8080),handler)
server.serve_forever()

This is my ftpclient.py that needs to connect with the above server:

from ftplib import FTP

ftp = FTP('')
host='localhost'
port=8080
ftp.connect(host,port)
ftp.login()

print(ftp.getwelcome())
print('Current Directory ',ftp.pwd())

ftp.dir()

ftp.quit()

When I test my server and client on same machine it worked. But when I run the same server on another machine and tried to connect with my client it gave me error:

error: [Errno 10061] No connection could be made because the target machine actively refused it

2 Answers 2

4

If you run the client on another machine, you have to connect to the host of the server, not to "localhost":

host='<server_host>'

Run ipconfig on your Windows server machine and look for "IPv4 address".

Sign up to request clarification or add additional context in comments.

Comments

0

Replace port = 1027 with port = 8080 in your ftpclient file.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.