BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to write to all connected clients at once? indy10/d7

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
Jacques
Guest





PostPosted: Tue Mar 22, 2005 3:28 am    Post subject: How to write to all connected clients at once? indy10/d7 Reply with quote



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





PostPosted: Tue Mar 22, 2005 9:21 pm    Post subject: Re: How to write to all connected clients at once? indy10/d7 Reply with quote




"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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.