diff --git a/NamedPipeWrapper/NamedPipeServer.cs b/NamedPipeWrapper/NamedPipeServer.cs index 7795a2a..680c789 100644 --- a/NamedPipeWrapper/NamedPipeServer.cs +++ b/NamedPipeWrapper/NamedPipeServer.cs @@ -96,6 +96,24 @@ public void PushMessage(TWrite message) } } } + + /// + /// Sends a message to all connected clients asynchronously. + /// This method returns immediately, possibly before the message has been sent to all clients. + /// + /// + /// Send to a Target client + public void PushMessage(TWrite message, string TargetCleintName) + { + if (TargetCleintName == null) + throw new ArgumentNullException("TargetCleintName is null"); + + var client = _connections.Where(p => p.Name == TargetCleintName).SingleOrDefault(); + if (client != null) + client.PushMessage(message); + else + throw new Exception("Is Not Exist TargetName"); + } /// /// Closes all open client connections and stops listening for new ones.