Hello,

This will send 'str1' to all local connections, and 'str2' to all remote
connections. Is it this what you ask for ?

procedure TForm1.SendToAllBtnClick(Sender: TObject);
var
   n: integer;
   Client: TClient;
begin
   for n := 0 to WSocketServer.ClientCount - 1 do try
      Client := WSocketServer.Client[n];
      Client.SendStr('str1');
      Client.RemoteSocket.SendStr('str2');
   except
   end;
end;

try/exept because some connection could have been closed during the loop

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

Monday, October 31, 2005, 23:36, ICSNewbie2005 wrote:

> Wilfried,
> ty for quick response, i hope this gets to the mailing list as my last
> message has not posted. Maybe i can better explain what i'm talking about in
> better details.
>  I have socketspy open on my PC and i'd like to send one specific packet to
> local connection and one specific packet to remote connection quite
> frequently. I wrote a quick bouncer using TClientSocket and TServerSocket
> and it worked fine for me like this.
>  Procedure TForm1.Button1Click(Sender: TObject);
> var i: integer;
> begin
> for i := 0 to ServerSocket1.Socket.ActiveConnections -1 do
> ServerSocket1.Socket.Connections[i].SendText(Packet1);
> ClientSocket1.Socket.SendText(Packet2);
> end;
>  This means that remote socket and local socket both get their own (unique)
> packets and I can call the methods of both the client and the server sockets
> anywhere on my form, in any event handler.
>  I am trying to do exact same thing with ICS TWSocket using the SocketSpy
> source code that Wilfried has written. So what i'm asking is how can i send
> data to remote and local connections without conflicts so that i can send
> data to whichever connection, local or remote, any time i need to in any
> form event.
>  Thanks,
> ICSNewbie05

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to