1
votes

I am trying to connect to an FTP server in Passive mode from Python (through Socket)

i am doing it this way:

mftp = socket (AF_INET, SOCK_STREAM)
mftp.connect((serverHost, 21))
print mftp.recv(1024)
print mftp.close()

but this command (.connect) i believe opens an active connection to the server. How can i open a passive connection. Please help, and also while responding, also consider i am very new to Python ... :)

Regards, M.Ali

1

1 Answers

0
votes

Not answering your question... but did you know Python has an FTP module as part of its standard library? It might be suitable for your needs, and could save you a lot of time.