-1

I'm currently working on a project where i need FTP-file access on a local network. That is if I'm on the same network as another device, we will be able to share file using FTP. Problem is, it doesn't work.

I can connect to the server on the same machine that I'm running the script on, by going to ftp://192.168.1.xxx:xxx in my browser, but when I try to connect in the same way from a different machine that is on the same network, it doesn't work. It just can't find the ip-adress. I can host the script on that machine and connect to it, but then I can't connect from the 1st machine.

I'm really confused since I've tried the socket module before and it worked flawlessly just by doing in a similar way. Does any of you have an idea what this could be about? Here's the script that I'm using (note that it is extremly similar to the example code from the pyftpdlib documentation):

from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer
from socket import gethostbyname, gethostname

server = None

def start_server(*, port=8080):
    authorizer = DummyAuthorizer()
    authorizer.add_user("user", "abc123", "C:\\", perm="elradfmwMT")
    authorizer.add_anonymous("C:\\")

    handler = FTPHandler
    handler.authorizer = authorizer
    handler.banner = ''

    address = gethostbyname(gethostname())

    server = FTPServer((address, port), handler)
    server.serve_forever()
    
def close_server():
    if server == None:
        print('Server has not started yet!')
        return

    server.close_all()

start_server()
Blupper
  • 378
  • 2
  • 10

1 Answers1

0

As Martin Prikryl stated, it was a problem with the Windows firewall preventing access. I simply had to open up the port I was using in the windows firewall settings.

Blupper
  • 378
  • 2
  • 10