TIDTCPCMDServer multi broadcast lists

Using Indy 10

Looking for a faster way to support multiple broadcast lists for multiple chats on same TcpCmdServer component

For example, if client #1 is in 3 chats, it will be in 3 lists, etc..

at this time, i'm using a very time consuming loop to search for a match of the peerIP within a specific string.

 
  ContextsList := svr.Contexts.LockList;
  with ContextsList do
  begin
    for i := 0 to svr.Contexts.Count-1  do
    begin
      cx := ContextsList[i];
      if pos(cx.peerIp, sBroadcastList)>0 then
        cx.Binding.Send(s);
    end;
  end;

Open in new window

TIA
controlrAsked:
Who is Participating?
 
controlrAuthor Commented:
as it stands, the current implementation is the fastest.
thanks for the effort.  partial points awarded
0
 
Sinisa VukCommented:
Maybe you can use TList where you can store unique client id (maybe if you transfer ip address from string
to integer v1.v2.v3.v4 --> v1*16777216+v2*65536+v3*256+v4) - searching integer is faster than string.
0
 
controlrAuthor Commented:
that will be actually slower, as the user ID is already sorted and IP's are a secondary field..

Would TIDTCPCMDServer  be able to handle a paralleled  loop workload on  the connections?  or will it cause issues?
0
 
controlrAuthor Commented:
partial points for efforts, solution is not faster than current implementation
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.