RTC Forums
April 18, 2024, 01:08:03 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: A Question about using raw components  (Read 4495 times)
levi
Newbie
*
Posts: 4


« 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!

Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 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
Logged
levi
Newbie
*
Posts: 4


« Reply #2 on: February 17, 2014, 02:37:25 PM »

Thanks.
Logged
levi
Newbie
*
Posts: 4


« Reply #3 on: February 19, 2014, 12:37:12 PM »

I Test this work well.
Thanks!
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #4 on: February 19, 2014, 12:52:22 PM »

Thanks for your feedback.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.023 seconds with 16 queries.