private static byte[] BuildRemotingServerMessage(RemotingResponse remotingResponse)
        {
            byte[] remotingResponseData  = RemotingUtil.BuildResponseMessage(remotingResponse);
            var    remotingServerMessage = new RemotingServerMessage(
                RemotingServerMessageType.RemotingResponse,
                100,
                remotingResponseData,
                null);

            return(RemotingUtil.BuildRemotingServerMessage(remotingServerMessage));
        }
Exemple #2
0
        private void HandleServerPushMessage(ITcpConnection connection, RemotingServerMessage message)
        {
            IRemotingServerMessageHandler messageHandler;

            if (_remotingServerMessageHandlerDict.TryGetValue(message.Code, out messageHandler))
            {
                messageHandler.HandleMessage(message);
            }
            else
            {
                LogUtil.ErrorFormat("No handler found for remoting server message:{0}", message);
            }
        }
Exemple #3
0
        public static byte[] BuildRemotingServerMessage(RemotingServerMessage message)
        {
            byte[] IdBytes;
            byte[] IdLengthBytes;
            ByteUtil.EncodeString(message.Id, out IdLengthBytes, out IdBytes);

            var typeBytes         = BitConverter.GetBytes(message.Type);
            var codeBytes         = BitConverter.GetBytes(message.Code);
            var createdTimeBytes  = ByteUtil.EncodeDateTime(message.CreatedTime);
            var headerBytes       = HeaderUtil.EncodeHeader(message.Header);
            var headerLengthBytes = BitConverter.GetBytes(headerBytes.Length);

            return(ByteUtil.Combine(
                       IdLengthBytes,
                       IdBytes,
                       typeBytes,
                       codeBytes,
                       createdTimeBytes,
                       headerLengthBytes,
                       headerBytes,
                       message.Body));
        }
Exemple #4
0
        public void PushMessageToAllConnections(RemotingServerMessage message)
        {
            var data = RemotingUtil.BuildRemotingServerMessage(message);

            _serverSocket.PushMessageToAllConnections(data);
        }