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(); }