|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Passive mode confusion
Hi all,
I'm trying to switch passive mode false programatically but it doesn't work, whereas, if i do the same thing from the command line, it works?? Any pointers as to what i'm doing wrong? Take a look at the below where i'm switching modes successfully on the commandline but when i Telnet to the FTP port the raw commands don't have the same effect. Thanks Kashif [kashif@hammerhead src]$ ftp ftp.someserver.co.uk Trying x.x.x.x... Connected to ftp.someserver.co.uk (x.x.x.x). 220 someserver SYSTEMS FTP SERVER READY. Name (ftp.someserver.co.uk:kashif): myusername 331 Password required for myusername Password: 230 User myusernamel logged in. Remote system type is UNIX. Using binary mode to transfer files. ftp> put 22042005_093820.txt local: 22042005_093820.txt remote: 22042005_093820.txt 502 PASV not allowed by someserver server Passive mode refused. ftp> passive Passive mode off. ftp> put 22042005_093820.txt local: 22042005_093820.txt remote: 22042005_093820.txt 200 PORT command successful. 150 BINARY data connection for 22042005_093820.txt. 226 JOB = 51909377 - Transfer complete. (83 Bytes rcvd) 83 bytes sent in 5.5e-05 secs (1.5e+03 Kbytes/sec) ftp> quit 221 Goodbye. [kashif@hammerhead src]$ telnet ftp.someserver.co.uk 21 Trying x.x.x.x... Connected to ftp.someserver.co.uk. Escape character is '^]'. 220 someserver SYSTEMS FTP SERVER READY. USER myusername 331 Password required for myusername. PASS mypassword 230 User myusername logged in. PASV 502 PASV not allowed by someserver server quit 221 Goodbye. Connection closed by foreign host. [kashif@hammerhead src]$ telnet ftp.someserver.co.uk 21 Trying x.x.x.x... Connected to ftp.someserver.co.uk. Escape character is '^]'. 220 someserver SYSTEMS FTP SERVER READY. USER myusername 331 Password required for myusername. PASS mypassword 230 User myusername logged in. STOR 22042005_093820.txt 425 Can't build data connection: Connection refused. PASV 502 PASV not allowed by someserver server STOR 22042005_093820.txt 425 Can't build data connection: Connection refused. |
|
#2
|
||||
|
||||
|
To me the output looks fine.
Your ftp client has passive mode as default. When you try to put, it sends the PASV command and gets refused. When you use telnet, you are able to see the effect clearly. Quote:
If you want to do this programmatically, you need to listen for incoming active connection before you send RETR or STOR commands. You can choose a non-default port if you send a PORT command. |
![]() |
| Viewing: Dev Shed Forums > System Administration > FTP Help > Passive mode confusion |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|