为什么下载小文件正常。。下一个2.4M的文件就出错了。
错误信息为:socket 发送错误!procedure TForm1.FormCreate(Sender: TObject);
begin
NMHTTP1.InputFileMode:=true;
NMHTTP1.TimeOut:=2000;
NMHTTP1.Body:='tempfileName';
NMHTTP1.Header:='HeaderFileName'; ProgressBar1.Min:=0;
ProgressBar1.Max:=100;
ProgressBar1.Position:=0;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
NMHTTP1.Get(edtURL.Text);
end;procedure TForm1.NMHTTP1Success(Cmd: CmdType);
var
filName:string;
buf:string;
pnewfile,poldFile:pchar;
i:integer;
begin
filName:=NMHTTP1.Body;
for i:=length(edtURL.Text) downto 1 do
if edtURL.Text[i]<>'/' then
buf:=edtURL.Text[i]+buf
else
break; GetMem(poldFile,length(filName)+1);
strPcopy(poldFile,filName); GetMem(pnewFile,length(filName)+1);
strPcopy(pnewFile,buf); MoveFile(poldFile,pnewFile);
freemem(poldfile);
FreeMem(pNewFile); statusbar1.Panels.Items[0].Text:='下载完成';
tempFileName.Caption:=filName;
finalFileName.Caption:=buf;
end;
错误信息为:socket 发送错误!procedure TForm1.FormCreate(Sender: TObject);
begin
NMHTTP1.InputFileMode:=true;
NMHTTP1.TimeOut:=2000;
NMHTTP1.Body:='tempfileName';
NMHTTP1.Header:='HeaderFileName'; ProgressBar1.Min:=0;
ProgressBar1.Max:=100;
ProgressBar1.Position:=0;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
NMHTTP1.Get(edtURL.Text);
end;procedure TForm1.NMHTTP1Success(Cmd: CmdType);
var
filName:string;
buf:string;
pnewfile,poldFile:pchar;
i:integer;
begin
filName:=NMHTTP1.Body;
for i:=length(edtURL.Text) downto 1 do
if edtURL.Text[i]<>'/' then
buf:=edtURL.Text[i]+buf
else
break; GetMem(poldFile,length(filName)+1);
strPcopy(poldFile,filName); GetMem(pnewFile,length(filName)+1);
strPcopy(pnewFile,buf); MoveFile(poldFile,pnewFile);
freemem(poldfile);
FreeMem(pNewFile); statusbar1.Panels.Items[0].Text:='下载完成';
tempFileName.Caption:=filName;
finalFileName.Caption:=buf;
end;
解决方案 »
- 最近在看一个源代码的时候 在其中一个类中对方使用了count
- 两个dbgrideh如何设置为一样的属性?
- 聊天工具里显示和输入聊天信息的是用什么控件?
- 非常奇怪的问题,用restore database恢复数据库,在sqlserver里面数据怎么没有恢复啊!大家帮忙指点一下,谢谢了!
- 100分求证,用什么刻录软件能将2G的文件刻录在一张刻录盘内?分不够再给!大家帮忙!!!
- 很长时间没csdn了.很想念大家!祝福大家身体健康!
- 怎样用程序在BDE中设别名设定??
- 100份~ADO操作Excel的问题
- ClientDataset有没有ADOQuery的NextRecordSet(i)相似命令
- 关于服务的问题,(急!!!!!)
- 急。。。。救助。。
- 求标准DLL封装ADO访问SQLSERVER的方法
NM没开源,什么都不好办http://lysoft.7u7.net
但是这是为什么呀???