Mega Search
23.2 Million


Sign Up

Make a donation  
TIdFTP error 220 [Edit]  
News Group: embarcadero.public.delphi.internet.winsock

Updated to Indy 10.5207 in case it would help, but didn't. TIdFTP is having trouble connecting to a FileZilla server in UNIX mode. I can connect fine with some FTP client software.

A FTP.Connect generates an exception with no message. On E:Exception ShowMessage(E.Message) shows a blank message.
LastCmdResult.Code = 220
LastCmdResult.Text = the name of the server

Passive and active modes don't work. I've not seen this before. The same code works fine for hundreds of other servers.  Any ideas?  I can provide IP and some login credentials privately if required.

Thanks.

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 21-Nov-2014, at 5:09 PM EST
From: Ross Levis
 
Re: TIdFTP error 220 [Edit]  
News Group: embarcadero.public.delphi.internet.winsock
Ross wrote:

> Does that mean in future if UseHost is True, and a disconnection
> occurs during a HOST command, the component will reattempt a
> connection with UseHost False?

Yes.  It was already doing that, but only if the disconnect was detected 
after receiving the HOST reply.  I have updated it so it can also handle 
the disconnect if it happens while sending the HOST command or reading its 
reply.

--
Remy Lebeau (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 22-Nov-2014, at 1:02 PM EST
From: Remy Lebeau (TeamB)
 
Re: TIdFTP error 220 [Edit]  
News Group: embarcadero.public.delphi.internet.winsock
> {quote:title=Remy Lebeau (TeamB) wrote:}
I have checked in an update for it.{quote}

Does that mean in future if UseHost is True, and a disconnection occurs during a HOST command, the component will reattempt a connection with UseHost False?

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 22-Nov-2014, at 2:15 AM EST
From: Ross Levis
 
Re: TIdFTP error 220  
News Group: embarcadero.public.delphi.internet.winsock
Remy wrote:

> The socket is being closed by the server after TIdFTP has sent a
> HOST command to the server and before the reply has been received.
> Several popular FTP servers are known to close the socket after a
> failed HOST command, but they all typically send a reply before
> disconnecting.  Your stack trace suggests the socket is being closed
> first.  TIdFTP will have to be updated to account for that.

I have checked in an update for it.

--
Remy Lebeau (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 22-Nov-2014, at 12:56 AM EST
From: Remy Lebeau (TeamB)
 
Re: TIdFTP error 220  
News Group: embarcadero.public.delphi.internet.winsock
Ross wrote:

> exception class    : EIdSocketError
> exception message  : Socket Error # 10054 Connection reset by peer.

The socket is being closed by the server after TIdFTP has sent a HOST command 
to the server and before the reply has been received.  Several popular FTP 
servers are known to close the socket after a failed HOST command, but they 
all typically send a reply before disconnecting.  Your stack trace suggests 
the socket is being closed first.  TIdFTP will have to be updated to account 
for that.  In the meantinme, you can set the TIdFTP.UseHOST property to false.

--
Remy Lebeau (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 22-Nov-2014, at 12:23 AM EST
From: Remy Lebeau (TeamB)
 
Re: TIdFTP error 220  
News Group: embarcadero.public.delphi.internet.winsock
Hello Ross,

> The ClassName is EIdSocketError.

Then you are not getting an FTP error.  The underlying socket is failing, 
such as if the socket is being closed as soon as you connect.

> Removing the try..except code doesn't produce an exception in
> the the debugger, perhaps because it executing from a thread.

The debugger shows exceptions regardless of thread context.  What is more 
likely the case is that you have EIdSocketError in the debugger's list of 
exception types to ignore.

--
Remy Lebeau (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 22-Nov-2014, at 12:17 AM EST
From: Remy Lebeau (TeamB)
 
Re: TIdFTP error 220  
News Group: embarcadero.public.delphi.internet.winsock
I have madExcept operating. Let me know if you prefer something else. It may require me sending you the connection details privately. Let me know.

exception class    : EIdSocketError
exception message  : Socket Error # 10054 Connection reset by peer.

main thread ($b38):
004c7abb Project1.exe IdStack           894 +53 TIdStack.RaiseSocketError
004c7a42 Project1.exe IdStack           828  +1 TIdStack.RaiseLastSocketError
004c79ad Project1.exe IdStack           802  +2 TIdStack.CheckForSocketError
004c38a5 Project1.exe IdStackBSDBase    424  +1 TIdStackBSDBase.Receive
004cdf1f Project1.exe IdSocketHandle    319  +1 TIdSocketHandle.Receive
004d055c Project1.exe IdIOHandlerStack  377  +2 TIdIOHandlerStack.ReadDataFromSource
004cc330 Project1.exe IdIOHandler      1527 +28 TIdIOHandler.ReadFromSource
004cbfa3 Project1.exe IdIOHandler      1364 +57 TIdIOHandler.ReadLn
004cbda1 Project1.exe IdIOHandler      1282  +1 TIdIOHandler.ReadLn
004cc175 Project1.exe IdIOHandler      1477 +10 TIdIOHandler.ReadLnWait
004efc8d Project1.exe IdFTP            3472 +16 TIdFTP.GetInternalResponse
004d4d76 Project1.exe IdTCPConnection   588  +1 TIdTCPConnection.GetResponse
004d4ea9 Project1.exe IdTCPConnection   609  +4 TIdTCPConnection.SendCmd
004d51cb Project1.exe IdTCPConnection   797  +2 TIdTCPConnection.SendCmd
004ed82c Project1.exe IdFTP            1430 +10 TIdFTP.SendHost
004ed376 Project1.exe IdFTP            1311 +75 TIdFTP.Connect

cpu registers:
eax = 0071d418
ebx = 004c3e3c
ecx = 00000002
edx = 004c7ac0
esi = 00000000
edi = 00000000
eip = 004c7ac0
esp = 0018fa9c
ebp = 0018faec

stack dump:
0018fa9c  c0 7a 4c 00 de fa ed 0e - 01 00 00 00 07 00 00 00  .zL.............
0018faac  b0 fa 18 00 c0 7a 4c 00 - 18 d4 71 00 3c 3e 4c 00  .....zL...q.<>L.
0018fabc  00 00 00 00 00 00 00 00 - ec fa 18 00 cc fa 18 00  ................
0018facc  5c fb 18 00 f4 42 40 00 - ec fa 18 00 3c 3e 4c 00  \....B@.....<>L.
0018fadc  00 00 00 00 00 00 00 00 - 46 27 00 00 44 46 71 00  ........F'..DFq.
0018faec  f8 fa 18 00 45 7a 4c 00 - 44 46 71 00 0c fb 18 00  ....EzL.DFq.....
0018fafc  b2 79 4c 00 44 46 71 00 - ff ff ff ff 44 46 71 00  .yL.DFq.....DFq.
0018fb0c  28 fb 18 00 aa 38 4c 00 - 3c 3e 4c 00 5c 50 71 00  (....8L.<>L.\Pq.
0018fb1c  90 fb 18 00 e0 01 00 00 - 44 46 71 00 40 fb 18 00  ........DFq.@...
0018fb2c  22 df 4c 00 b0 fe 4c 00 - b0 fe 4c 00 90 fb 18 00  ".L...L...L.....
0018fb3c  f8 4a 71 00 54 fb 18 00 - 61 05 4d 00 01 00 00 00  .Jq.T...a.M.....
0018fb4c  90 fb 18 00 3c 31 71 00 - ac fb 18 00 33 c3 4c 00  ....<1q.....3.L.
0018fb5c  68 fb 18 00 f4 42 40 00 - ac fb 18 00 b8 fb 18 00  h....B@.........
0018fb6c  f4 42 40 00 ac fb 18 00 - b0 fe 4c 00 00 00 00 00  .B@.......L.....
0018fb7c  00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  ................
0018fb8c  00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  ................
0018fb9c  00 00 00 00 60 ea 00 00 - b3 05 4d 01 3c 31 71 00  ....`.....M.<1q.
0018fbac  fc fb 18 00 a8 bf 4c 00 - 00 00 00 00 14 fc 18 00  ......L.........
0018fbbc  f4 42 40 00 fc fb 18 00 - b0 fe 4c 00 00 00 00 00  .B@.......L.....
0018fbcc  00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  ................

disassembling:
[...]
004c7a9d       mov     edx, [ebp-8]
004c7aa0       mov     eax, [ebp-4]
004c7aa3       mov     ebx, [eax]
004c7aa5       call    dword ptr [ebx+$48]
004c7aa8       mov     eax, [ebp-$10]
004c7aab       push    eax
004c7aac       mov     ecx, [ebp-8]
004c7aaf       mov     dl, 1
004c7ab1       mov     eax, [$4c6d20]
004c7ab6       call    -$6eb ($4c73d0)        ; IdStack.EIdSocketError.CreateError
004c7abb     > call    -$c3700 ($4043c0)      ; System.@RaiseExcept
004c7ac0       xor     eax, eax
004c7ac2       pop     edx
004c7ac3       pop     ecx
004c7ac4       pop     ecx
004c7ac5       mov     fs:[eax], edx
004c7ac8       push    $4c7ae2
004c7acd       lea     eax, [ebp-$10]
004c7ad0       mov     edx, 2
004c7ad5       call    -$c3086 ($404a54)      ; System.@LStrArrayClr
004c7ada       ret

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 21-Nov-2014, at 11:20 PM EST
From: Ross Levis
 
Re: TIdFTP error 220  
News Group: embarcadero.public.delphi.internet.winsock
The ClassName is EIdSocketError.

Removing the try..except code doesn't produce an exception in the the debugger, perhaps because it executing from a thread.

I'll create a new app and run a connect in the main thread and get back to you.

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 21-Nov-2014, at 10:54 PM EST
From: Ross Levis
 
Re: TIdFTP error 220  
News Group: embarcadero.public.delphi.internet.winsock
> {quote:title=Ross Levis wrote:}{quote}
> A FTP.Connect generates an exception with no message. On E:Exception ShowMessage(E.Message) shows a blank message.
> LastCmdResult.Code = 220
> LastCmdResult.Text = the name of the server

What is the ClassName of the exception?  What does the debugger show as the call stack when the exception is raised? 220 is the server's normal greeting response code. TIdFTP would not raise an exception on that.  Something else is failing, but there is not enough information to know what that is.

--
Remy Lebeau (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 21-Nov-2014, at 9:30 PM EST
From: Remy Lebeau (TeamB)