| View previous topic :: View next topic |
| Author |
Message |
Jacques Guest
|
Posted: Tue Mar 22, 2005 3:28 am Post subject: How to write to all connected clients at once? indy10/d7 |
|
|
This is the code i have so far..
procedure Tp2pChatForm.DoBroadcast(const s: string);
// broadcast a message to all connected nodes
var
idx: Integer;
lList: TList;
begin
// send it out on the client connection if connected
if ClientSocket.Connected then
ClientSocket.IOHandler.WriteLn(s);
// Send it to all clients connected to the server socket
lList := ServerSocket.Contexts.LockList;
try
//try send
for idx := 0 to pred(lList.Count) do
acontext.writeln(s);?? //this is were i'd like to write to everybody
connected
finally
ServerSocket.Threads.UnlockList;
end;
end;
thanks
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Mar 22, 2005 9:21 pm Post subject: Re: How to write to all connected clients at once? indy10/d7 |
|
|
"Jacques" <jacques.noah (AT) btinternet (DOT) com> wrote
| Quote: | acontext.writeln(s);?? //this is were i'd like to write to everybody
connected
|
TIdContext has a Connection property, which in turn has an IOHandler.
Gambit
|
|
| Back to top |
|
 |
|