GSF.ServiceProcess.ServiceHelper.SendResponse C# (CSharp) Method

SendResponse() public method

Sends the specified response to the specified client only.
public SendResponse ( System.Guid client, ServiceResponse response, bool async ) : void
client System.Guid ID of the client to whom the is to be sent.
response ServiceResponse The to be sent to the .
async bool Flag to determine whether to wait for the send operations to complete.
return void
        public void SendResponse(Guid client, ServiceResponse response, bool async)
        {
            try
            {
                WaitHandle[] handles = new WaitHandle[0];

                if (client != Guid.Empty)
                {
                    // Send message directly to specified client.
                    if (m_remotingServer.IsClientConnected(client))
                        handles = new[] { m_remotingServer.SendToAsync(client, response) };
                }
                else
                {
                    // Send message to all of the connected clients.
                    if (m_remoteCommandClientID == Guid.Empty)
                    {
                        lock (m_remoteClients)
                        {
                            handles = m_remoteClients.Select(clientInfo => m_remotingServer.SendToAsync(clientInfo.ClientID, response)).ToArray();
                        }
                    }
                }

                if (!async)
                    WaitHandle.WaitAll(handles);
            }
            catch (Exception ex)
            {
                // Log the exception.
                LogException(ex);
            }
        }

Same methods

ServiceHelper::SendResponse ( System.Guid client, ServiceResponse response ) : void
ServiceHelper::SendResponse ( ServiceResponse response ) : void
ServiceHelper