Lazarus中文社区

 找回密码
 立即注册(注册审核可向QQ群索取)

QQ登录

只需一步,快速开始

Lazarus IDE and 组件 下载地址版权申明
查看: 3925|回复: 0

请教一个 lnet Tcp的问题

[复制链接]

该用户从未签到

发表于 2010-7-18 14:10:45 | 显示全部楼层 |阅读模式
LTCPComponent接收正常,发送出的数据无法收到,想了很多办法都没解决,希望会的朋友指点下,谢谢。

方法1:
连接 LTCPComponent1.Connect('192.168.1.2',7000)

发送 if LTCPComponent1.Connected then begin
LTCPComponent1.SendMessage(Edt_TCPInfo.Text)

方法2
连接 LTCPComponent1.Connect('192.168.1.2',7000)

然后在LTCPComponent1的事件里面写入
procedure TForm1.OnCanSend(aSocket: TLSocket);
var
  n: Integer;
begin
  repeat
    n := LTCPComponent1.Send(FBuffer[FSendIndex], Length(FBuffer) - FSendIndex);
    Inc(FSendIndex, n);
  until (n = 0) or (FSendIndex > Length(FBuffer));
end;

发送
FBuffer := Edit1.Text;
  LTCPComponent1.OnCanSend(LTCPComponent1.Iterator);



其中还发现一个问题LTCPComponent1.Connect 参数任意写 都返回成功。。。

正常连接的时候服务端能收到连接成功的信息,但是以上2中方法都发送不出数据。。。
回复

使用道具 举报

*滑块验证:

本版积分规则

QQ|手机版|小黑屋|Lazarus中国|Lazarus中文社区 ( 鄂ICP备16006501号-1 )

GMT+8, 2025-5-2 22:23 , Processed in 0.154518 second(s), 10 queries , Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表