关于多线程的FTP程序的编写(35分)

  • 主题发起人 主题发起人 流云
  • 开始时间 开始时间

流云

Unregistered / Unconfirmed
GUEST, unregistred user!
我尝试写一个多线程的Ftp客户端,我的代码如下:
线程的声明:
class TFtpMirroThread:public TThread
{
public:
__fastcall TFtpMirroThread(AnsiString theMirroIP);
private:
AnsiString MirroIP;
TClientSocket *MirroFtpSocket;
void __fastcall Execute(void);
void __fastcall Writelog(void);
};
void __fastcall TFtpMirroThread::Execute(void)
{
if (MirroIP=="127.0.0.1"){
MirroFtpSocket->Address=MirroIP;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^这里就要错!
MirroFtpSocket->Port=21;
MirroFtpSocket->ClientType=ctBlocking;
}
}
构造函数:
__fastcall TFtpMirroThread::TFtpMirroThread(AnsiString theMirroIP):TThread(true)
{
FreeOnTerminate=true;
MirroIP=theMirroIP;
Resume();
}
创建线程对象:
AnsiString MirroFtpIP1;
MirroFtpIP1="127.0.0.1";
MirroFtp1=new TFtpMirroThread(MirroFtpIP1);
请问该怎么做这样的程序
显示一个应用错误:
Exception EAccessViolation in module Vcl40.bpl at 000DC9E6.
Access violation at address 400DC9E6 in module 'Vcl40.bpl'.Read of
address 0000002C.
 
你还漏了
MirroFtpSocket = new TClientSocket(NULL)
 
接受答案了.
 
后退
顶部