This commit is contained in:
mysticbbs 2013-09-24 04:40:40 -04:00
parent 483fcf25c5
commit 4682194e48
2 changed files with 26 additions and 10 deletions

View File

@ -68,7 +68,7 @@ Begin
If Client.FSocketHandle = -1 Then Exit; If Client.FSocketHandle = -1 Then Exit;
// WriteLn ('DEBUG SENT ' + Str); WriteLn ('DEBUG SENT ' + Str);
Client.PurgeInputData(1); Client.PurgeInputData(1);
@ -93,7 +93,7 @@ Begin
ResponseType := strS2I(Copy(ResponseStr, 1, 3)); ResponseType := strS2I(Copy(ResponseStr, 1, 3));
Result := ResponseType; Result := ResponseType;
// WriteLn ('DEBUG RECV ' + ResponseStr); WriteLn ('DEBUG RECV ' + ResponseStr);
// writeln('debug restype=', responsetype); // writeln('debug restype=', responsetype);

View File

@ -6,6 +6,7 @@ Interface
Uses Uses
m_io_Sockets, m_io_Sockets,
sockets,
m_Tcp_Client; m_Tcp_Client;
Const Const
@ -129,9 +130,10 @@ Begin
If SendCommand('USER ' + Login) <> 331 Then Exit; If SendCommand('USER ' + Login) <> 331 Then Exit;
If SendCommand('PASS ' + Password) <> 230 Then Exit; If SendCommand('PASS ' + Password) <> 230 Then Exit;
// tossing in BIN mode here for lack of a better place // Setup misc session crap here
If SendCommand('TYPE I') = 200 Then; If SendCommand('TYPE I') = 200 Then;
If SendCommand('MODE S') = 200 Then;
Result := True; Result := True;
End; End;
@ -268,9 +270,10 @@ Begin
End; End;
Function TFTPClient.GetDirectoryList (Passive, Change: Boolean; Str: String) : Boolean; Function TFTPClient.GetDirectoryList (Passive, Change: Boolean; Str: String) : Boolean;
Var
OK : Boolean;
Res : LongInt;
Begin Begin
Result := False;
If Change Then Begin If Change Then Begin
Result := ChangeDirectory(Str); Result := ChangeDirectory(Str);
@ -280,22 +283,35 @@ Begin
SetPassive(Passive); SetPassive(Passive);
Client.WriteLine ('NLST'); Client.WriteLine ('NLST');
writeln('debug NLST');
If OpenDataSession and (GetResponse = 150) Then Begin OK := OpenDataSession;
Res := GetResponse;
Result := Res = 550;
If (Res in [125, 150]) Then Begin
writeln('debug got nlst response');
ResponseData.Clear; ResponseData.Clear;
Repeat Repeat
If DataSocket.ReadLine(Str) <> -1 Then If DataSocket.ReadLine(Str) <> -1 Then begin
ResponseData.Add(Str) ResponseData.Add(Str);
Else writeln('debug got ', str);
end Else begin
writeln('debug readline is -1');
writeln('debug ', socketerror);
Break; Break;
end;
Until Not DataSocket.Connected; Until Not DataSocket.Connected;
Result := GetResponse = 226; Result := GetResponse in [226, 550];
End; End;
CloseDataSession; CloseDataSession;
writeln('res final ', result);
End; End;
Procedure TFTPClient.CloseConnection; Procedure TFTPClient.CloseConnection;