By Tom Knorr on Wednesday, 20 September 2023
Posted in General
Replies 2
Likes 0
Views 754
Votes 0
How to iterate TsgcWebSocketServer active connections? Using C++Builder 11.3.

I'm familiar with doing so in Indy, but haven't found a way to do so.
Hello,

It's the same that with Indy. First Lock the connection list, iterate and the unlock the list. Find below an example for CBuilder


TList* oList;
oList = sgcWebSocketServer1->LockList();
try
{
for (int i = 0; i < oList->Count; i++)
{
TIdContext* Context = static_cast<TIdContext*>(oList->Items[i]);
TsgcWSConnection* Connection = static_cast<TsgcWSConnection*>(Context->Data);
}
}
__finally
{
sgcWebSocketServer1->UnLockList();
}


Kind Regards,
Sergio
·
1 year ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for the prompt response!
·
1 year ago
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post