Thread View: borland.public.cppbuilder.internet.socket
2 messages
2 total messages
Started by Alfred Thomas
Thu, 01 Jul 2004 13:30
Send message to all TIdServerSocket connections
Author: Alfred Thomas
Date: Thu, 01 Jul 2004 13:30
Date: Thu, 01 Jul 2004 13:30
13 lines
1211 bytes
1211 bytes
Hi
I am trying to send a message to all the clients connected to a TIdTCPServerSocket component. I have tried the following:
for(int k = 0; k < ServerSocket->Bindings->Count; k++)
{
ServerSocket->Bindings->Items[k]->Send("XXXXX", 5, 0);
}
The code compiles and executes without error but the client does not receive the message.
Any ideas?
Regards
Alfred
Re: Send message to all TIdServerSocket connections
Author: Remy Lebeau (TeamB)
Date: Thu, 01 Jul 2004 17:26
Date: Thu, 01 Jul 2004 17:26
25 lines
1562 bytes
1562 bytes
"Alfred Thomas" <alfred@fischerint.co.za> wrote in message
news:40e411f8$1@newsgroups.borland.com...
> I am trying to send a message to all the clients connected
> to a TIdTCPServerSocket component.
There is no such component name. Perhaps you mean TIdTCPServer instead?
> I have tried the following:
You should be looping through the ActiveThreads list instead:
TList *pList = ServerSocket->ActiveThreads->LockList();
try
{
for(int k = 0; k < pList->Count; ++k)
static_cast<TIdPeerThread*>(pList->Items[k])->Write("XXXXX");
}
__finally {
ServerSocket->ActiveThreads->UnlockList();
}
Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads