关于socket传输文件的问题,请指教

tonyliu398 2004-12-26 02:43:18
请指教,我用自动搜索功能函数Searchpath为什么clientsocket1.Socket.SendText(MP_QUERY + path + searchrec.Name); 这句话不起作用
而通过对话框打开文件时服务器端却有反应,请高手指教
if OpenDialog1.Execute then
begin
clientsocket1.Socket.SendText(MP_QUERY + OpenDialog1.FileName);
end;

function TFrm_main.Searchpath(path: string): boolean;
var
searchrec: TSearchRec;
ext: string;
str: string;
begin
havefile := '0';
if path[length(path)] <> '\' then
path := path + '\';
if FindFirst(path + '*.*', faAnyFile, SearchRec) <> 0 then
exit;
while findnext(searchrec) = 0 do begin
if (searchrec.Attr and faDirectory) <> 0 then
begin
if (searchrec.name <> '.') and (searchrec.name <> '..') then
searchpath(path + searchrec.name)
end
else begin
//判断文件后缀名是否为指定类型
ext := lowercase(extractfileext(searchrec.Name));
if (ext = '.rar') or (ext = '.zip') then
begin
havefile := '1';
FileName := path + searchrec.Name;
clientsocket1.Socket.SendText(MP_QUERY + path + searchrec.Name);
application.ProcessMessages;
break;
end;
end;
end;
findclose(searchrec);
end;
...全文
85 点赞 收藏 回复
写回复
回复

还没有回复,快来抢沙发~

发动态
发帖子
网络通信/分布式开发
创建于2007-08-02

924

社区成员

3.3w+

社区内容

Delphi 网络通信/分布式开发
社区公告
暂无公告