IdTCPServer怎么样主动跟指定客服端发送数据?

xxxcyy 2016-09-08 05:21:01
不在OnExecute事件里面发送,代码如下:
TList *ListA;
int i;
ListA =IdTCPServer1->Threads->LockList();
for(i=0;i<ListA->Count;i++)
{
try
{
TIdPeerThread(ListA->Items[i])->Connection->WriteLn("Thread OK");
}
__finally
{

}
}
IdTCPServer1->Threads->UnlockList();

现在这句不能编译通过,
TIdPeerThread(ListA->Items[i])->Connection->WriteLn("Thread OK");

错误: [C++ Error] Unit1.cpp(287): E2288 Pointer to structure required on left side of -> or ->*

求教大家,谢谢.
...全文
212 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ooolinux 2016-09-09
  • 打赏
  • 举报
回复
有没有两次释放指针或者访问未初始化的对象?把一些delete先注释掉试试,有一些对象由VCL机制自动释放了,代码又手工delete。
xxxcyy 2016-09-09
  • 打赏
  • 举报
回复
改成TIdPeerThread(ListA->Items[i]).Connection->WriteLn("Thread OK");编译通过,但执行时会出错. Access violation at address 0041460C in modeule 'Project1.exe'.Read of address 0000000.
ooolinux 2016-09-08
  • 打赏
  • 举报
回复
可能是某个 -> 应该换成 .

1,316

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder 网络及通讯开发
社区管理员
  • 网络及通讯开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧