idTcpServer给idTcpClient发送消息

两者建立连接以后

idTcpService发送消息

if IdTcpServer1.active then 

begin

    ThreadList:=idTCpServicer1.ontexts.LockList;

     try

        for i:=0 to ThreadList.count-1 do

        begin

     TIdContext(ThreadList[i]).Connection.IoHandler.Writeln(edtSend.text,Tenconding.UTF8);

end;

     finally

        ThreadList.free;

        TidTcpService.Contexts.UnLockList;

     end;

end;

你可能感兴趣的:(网络)