您的位置:程序门 -> delphi -> 网络通信/分布式开发



为什么idudpclient.receivestring的值总是空的


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


为什么idudpclient.receivestring的值总是空的
发表于:2008-01-11 16:47:08 楼主
发送按钮的代码如下:
procedure   tform1.button1click(sender:   tobject);
var
    lv_str,   lv_localhostname,   lv_localhostip:   string;
begin
    lv_localhostname   :=   pv_getlocalname;   //取得本地计算机名
    showmessage(lv_localhostname);
    lv_localhostip   :=   pv_nametoip(lv_localhostname);
    showmessage(lv_localhostip);
    adodataset2.filtered   :=   true;
    adodataset2.filter   :=   format('userip'   +   '='   +   '''%s''',   [lv_localhostip]);
    gv_name   :=   adodataset2.fieldbyname('username').asstring;
    idudpclient1.host   :=   gv_ip;
    showmessage(gv_ip);
    if   length(memo2.lines.gettext)   >   0   then
    begin
        idudpclient1.send(memo2.lines.gettext);

        lv_str   :=   idudpclient1.receivestring;       //   用showmessage(lv_str)发现总是空的,是什么原因,麻烦大家指点,谢谢

        memo1.lines.insert(0,   gv_name   +   ':   '   +   lv_str);
        memo2.clear;
        memo2.lines.clear;
    end;
    memo2.setfocus;
end;
发表于:2008-01-18 16:51:451楼 得分:0
帮顶


快速检索

最新资讯