Esempio n. 1
0
 public ResponseFuture(RemotingRequest request, long timeoutMillis, TaskCompletionSource<RemotingResponse> taskSource)
 {
     Request = request;
     TimeoutMillis = timeoutMillis;
     _taskSource = taskSource;
     BeginTime = DateTime.Now;
 }
Esempio n. 2
0
        public static byte[] BuildRequestMessage(RemotingRequest request)
        {
            var sequenceBytes = BitConverter.GetBytes(request.Sequence);
            var codeBytes = BitConverter.GetBytes(request.Code);
            var typeBytes = BitConverter.GetBytes(request.Type);

            var message = new byte[12 + request.Body.Length];//long 8个字节 short2个字节
            sequenceBytes.CopyTo(message, 0);
            codeBytes.CopyTo(message, 8);
            typeBytes.CopyTo(message, 10);
            request.Body.CopyTo(message, 12);

            return message;
        }