L
Louz
Unregistered / Unconfirmed
GUEST, unregistred user!
代码如下,程序能正常执行,但就是不知道在List之后,怎样可以取得目录列表。我看过
cuteftp列表时的命令,是先cwd,再pasv,最后list的,我不清楚这时候怎样可以取得目
录列表,望各位大侠指教。
unit untClientSocket;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ScktComp, Psock, NMFtp,winsock;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
ClientSocket1: TClientSocket;
ListBox1: TListBox;
Edit2: TEdit;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure ClientSocket1Read(Sender: TObject; Socket: TCustomWinSocket);
procedure ClientSocket1Error(Sender: TObject; Socket: TCustomWinSocket;
ErrorEvent: TErrorEvent; var ErrorCode: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
//假设已经在clientsocket中设置好host、port等基本信息
procedure TForm1.Button1Click(Sender: TObject);
begin
ClientSocket1.Open;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ClientSocket1.Socket.SendText(Edit1.Text+#13#10) ;
end;
procedure TForm1.ClientSocket1Read(Sender: TObject;
Socket: TCustomWinSocket);
begin
ListBox1.ItemIndex:=ListBox1.Items.Add(Socket.ReceiveText);
end;
procedure TForm1.ClientSocket1Error(Sender: TObject;
Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
var ErrorCode: Integer);
begin
ListBox1.ItemIndex:=ListBox1.Items.add(IntToStr(ErrorCode)) ;
end;
end.
cuteftp列表时的命令,是先cwd,再pasv,最后list的,我不清楚这时候怎样可以取得目
录列表,望各位大侠指教。
unit untClientSocket;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ScktComp, Psock, NMFtp,winsock;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
ClientSocket1: TClientSocket;
ListBox1: TListBox;
Edit2: TEdit;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure ClientSocket1Read(Sender: TObject; Socket: TCustomWinSocket);
procedure ClientSocket1Error(Sender: TObject; Socket: TCustomWinSocket;
ErrorEvent: TErrorEvent; var ErrorCode: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
//假设已经在clientsocket中设置好host、port等基本信息
procedure TForm1.Button1Click(Sender: TObject);
begin
ClientSocket1.Open;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ClientSocket1.Socket.SendText(Edit1.Text+#13#10) ;
end;
procedure TForm1.ClientSocket1Read(Sender: TObject;
Socket: TCustomWinSocket);
begin
ListBox1.ItemIndex:=ListBox1.Items.Add(Socket.ReceiveText);
end;
procedure TForm1.ClientSocket1Error(Sender: TObject;
Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
var ErrorCode: Integer);
begin
ListBox1.ItemIndex:=ListBox1.Items.add(IntToStr(ErrorCode)) ;
end;
end.