Title: A Question about using raw components Post by: levi on February 17, 2014, 02:03:11 AM Hello:
I have a project. In it, I have to mark every connection of client,So I can send binary message to a certain client. Another mater I have is : How can I loop the Client connections and send message to all! How can I loop the Client connections and find a certain Client, then send message to it. I seach it on the forums, I found none. Best Regards! Title: Re: A Question about using raw components Post by: D.Tkalcec (RTC) on February 17, 2014, 09:10:14 AM You need to use the OnConnect event to store the "Sender:TRtcConnection" component in your own connection list, and use the "OnDisconnect" event to remove the component from the list. The OnConnect event is triggered when a connection is successfully established and you get the connection component as "Sender" parameter. The OnDisconnect event is triggered when a connection is closing and you also get the connection component as a "Sender" parameter there.
If your Server will be Multi-Threaded (set MultiThreaded property to True): 1. Use critical sections to secure access to your connection components list 2. Only call the "Read" or "ReadEx" methods from the OnDataReceived event 3. Use the "PostEvent" method (on the Sender:TRtcConnection component) when you need to send data to the Client or the Server. Only call the "Write" or "WriteEx" methods from within the event called by "PostEvent". Do NOT call "Write" or "WriteEx" from any ther place. Best Regards, Danijel Tkalcec Title: Re: A Question about using raw components Post by: levi on February 17, 2014, 02:37:25 PM Thanks.
Title: Re: A Question about using raw components Post by: levi on February 19, 2014, 12:37:12 PM I Test this work well.
Thanks! Title: Re: A Question about using raw components Post by: D.Tkalcec (RTC) on February 19, 2014, 12:52:22 PM Thanks for your feedback.
|