FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationFTP Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 22nd, 2005, 06:32 AM
KashifN KashifN is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: London, UK
Posts: 2 KashifN User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 18 sec
Reputation Power: 0
Send a message via MSN to KashifN
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.

Reply With Quote
  #2  
Old April 28th, 2005, 03:14 PM
LaughingBelly's Avatar
LaughingBelly LaughingBelly is offline
Who set my Title?
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2004
Posts: 528 LaughingBelly User rank is First Lieutenant (10000 - 20000 Reputation Level)LaughingBelly User rank is First Lieutenant (10000 - 20000 Reputation Level)LaughingBelly User rank is First Lieutenant (10000 - 20000 Reputation Level)LaughingBelly User rank is First Lieutenant (10000 - 20000 Reputation Level)LaughingBelly User rank is First Lieutenant (10000 - 20000 Reputation Level)LaughingBelly User rank is First Lieutenant (10000 - 20000 Reputation Level)LaughingBelly User rank is First Lieutenant (10000 - 20000 Reputation Level)LaughingBelly User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 5 h 19 m 42 sec
Reputation Power: 204
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:
425 Can't build data connection: Connection refused.
is the response from server saying you dont have anyone listening for the active connection the server is making.

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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > Passive mode confusion


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT