예제 #1
0
        bool ToClient(int clientSocketId, Message message, TimeSpan? requestConfirmTimeout)
        {
            SocketMessageServer server = _server;
            if (server == null)
            {
                return false;
            }

            ServerAccessControl accessControl = AccessControl;
            if (accessControl != null)
            {
                if (accessControl.IsAllowed(ObtainClientAccessControl(clientSocketId)) == false)
                {
            #if Matrix_Diagnostics
                    InstanceMonitor.OperationWarning("Message [" + message.ToString() + "] was not sent to client [" + clientSocketId + "] due to access control.");
            #endif
                    return false;
                }
            }

            message.MessageId = PendingMessageId;
            return server.SendAsync(clientSocketId, message, requestConfirmTimeout);
        }
예제 #2
0
 /// <summary>
 /// Constructor detailed.
 /// </summary>
 /// <param name="requestMessage"></param>
 public CommonResponseMessage(Message requestMessage)
 {
     base.MessageId = requestMessage.MessageId;
 }
예제 #3
0
        /// <summary>
        /// Helper, send message to server.
        /// </summary>
        bool ToServer(Message message, TimeSpan? requestConfirmTimeout)
        {
            SocketMessageClient messageClient = _socketClient;
            if (messageClient == null)
            {
                return false;
            }

            message.MessageId = PendingMessageId;
            return messageClient.SendAsync(message, requestConfirmTimeout) != SocketCommunicator.InvalidSendIndex;
        }