Indy TIdFTP 一個很奇怪的問題 |
缺席
|
pcernet
初階會員 發表:69 回覆:113 積分:41 註冊:2002-11-29 發送簡訊給我 |
我有兩個程式,其中寫TIdFTP的程式都一樣,但一台可以正常上傳,另一台則會出現類似死機的狀態,從FTP的Server端觀察到的日誌發現,有問題的那個程式,上傳時IP變成了Local IP,正常的那個程式則為正確的IP。
2008/10/29 [14:45] (00464) 168.95.131.24> User connecting from 168.95.131.24 2008/10/29 [14:45] (00464) 168.95.131.24> USER aloha 2008/10/29 [14:45] (00464) aloha> 331 User name okay, need password. 2008/10/29 [14:45] (00464) aloha> PASS ***** 2008/10/29 [14:45] (00464) aloha> 230 User logged in 2008/10/29 [14:45] (00464) aloha> FEAT 2008/10/29 [14:45] (00464) aloha> 500 Syntax error, command unrecognized. 2008/10/29 [14:45] (00464) aloha> TYPE I 2008/10/29 [14:45] (00464) aloha> 200 Type set to I 2008/10/29 [14:45] (00464) aloha> SYST 2008/10/29 [14:45] (00464) aloha> 215 UNIX system type. 2008/10/29 [14:45] (00464) aloha> PWD 2008/10/29 [14:45] (00464) aloha> 257 "/" is current dir. ////失敗 2008/10/29 [14:45] (00464) aloha> PORT 127,0,0,1,6,216 ------> IP變成LOCAL IP。 2008/10/29 [14:45] (00464) aloha> 200 Command okay. 2008/10/29 [14:45] (00464) aloha> STOR cocotv.exe ----->會一直停在這裡,檔案只有檔名建立,0Bytes。 2008/10/29 [14:46] (00464) aloha> User Disconnected. ////成功 2008/10/29 [15:39] (00464) aloha> PORT 168.95.131.24,8,112 2008/10/29 [15:39] (00464) aloha> 200 Command okay. 2008/10/29 [15:39] (00464) aloha> STOR cocotv.exe 2008/10/29 [15:39] (00464) aloha> 150 File status okay; Open data connection. 2008/10/29 [15:39] (00464) aloha> 226 Data Sent okay. 2008/10/29 [15:39] (00464) aloha> QUIT IdFtp1.Host:='168.95.131.33'; IdFtp1.Port:=21; IdFtp1.Username:='aloha'; IdFtp1.Password:='123'; if IdFTP1.Connected then IdFTP1.Disconnect; IdFTP1.Connect; IdFTP1.ChangeDir('/Z'); IdFTP1.Put('d:\cocotv.exe','cocotv.exe',false); ///停在這裡,有建立檔名,但都一直是0Bytes IdFTP1.Disconnect; 謝謝。 |
pcernet
初階會員 發表:69 回覆:113 積分:41 註冊:2002-11-29 發送簡訊給我 |
原來別人也有這個問題
http://newsgroups.cryer.info/atozedsoftware/indy.protocol.ftp/200806/0806302265.html I have this on the mainform: procedure TMainForm.ftptestClick(Sender: TObject); var ftp: TIdFTP; begin ftp := TIdFTP.Create(nil); ftp.Host := 'www._remotehost_.com'; ftp.Port := 21; ftp.Username := 'user'; ftp.Password := 'passwd'; ftp.Passive := false; // ftp.AutoLogin := true; ftp.Connect; // ftp.List(''); // ftp.Disconnect(); end; Same problem, binding.ip is 127.0.0.1. Can I have something in my project (linked unit ???) which causes the problem ? Thanks. "J Eisenheim" news:32CA82ABB559E340j.eisenheim@gmail.com... > Thank you for the answer! > > Something is wrong in my project. > I am using the latest Indy 10 snapshot, can you give me where should I > look to fix the problem? > > In IdFTP.pas line 1722 > > LPortSv.BoundIP := (Self.IOHandler as TIdIOHandlerSocket).Binding.IP; > > Binding.IP is 127.0.0.1, but I don't set this anywhere in the project. > Basically the idftp is created in a thread, with a few parameters set. > > My test machine is connected directly to the internet (PPPOE), > and assigning the correct external ip address to idftp does NOT works. > > The "Indy FTP Demo" works correctly. > > Any idea where should I look in my project ? > > Thank you! > > > "Remy Lebeau (TeamB)" > news:FFC3E66AAB59E340no.spam@no.spam.com... >> >> "J Eisenheim" >> news:C52C2BA67159E340j.eisenheim@gmail.com... >> >>> Testing the "Indy FTP Client Demo" works fine, sends the >>> correct PORT x,x,x,x,x,x command where I see my correct >>> external ip address. >> >> By default, that would only work if your machine is directly connected to >> your Internet provider. Otherwise, if you are behind a router, then you >> have to set the TIdFTP.ExternalIP property beforehand to the router's >> public IP. >> >>> But in my project I always receive the 425 Can't open >>> data connection message. In this case indy always sends >>> PORT 127,0,0,1,X,X. >> >> The only way that can happen is if you explicitally bound TIdFTP to >> 127.0.0.1 using the BoundIP property. Otherwise, it would send the >> machine's real IP instead. >> >>> Can you explain how Indy10 finds the external ip address ? >> >> It doesn't. You have to provide it yourself. >> >> >> Gambit |
pcernet
初階會員 發表:69 回覆:113 積分:41 註冊:2002-11-29 發送簡訊給我 |
|
HANGTEN
一般會員 發表:12 回覆:15 積分:5 註冊:2002-07-20 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |