public static byte[] BuildResponseMessage(RemotingResponse response) { var requestSequenceBytes = BitConverter.GetBytes(response.RequestSequence); var requestCodeBytes = BitConverter.GetBytes(response.RequestCode); var requestTypeBytes = BitConverter.GetBytes(response.RequestType); var requestTimeBytes = ByteUtil.EncodeDateTime(response.RequestTime); var requestHeaderBytes = HeaderUtil.EncodeHeader(response.RequestHeader); var requestHeaderLengthBytes = BitConverter.GetBytes(requestHeaderBytes.Length); var responseCodeBytes = BitConverter.GetBytes(response.ResponseCode); var responseTimeBytes = ByteUtil.EncodeDateTime(response.ResponseTime); var responseHeaderBytes = HeaderUtil.EncodeHeader(response.ResponseHeader); var responseHeaderLengthBytes = BitConverter.GetBytes(requestHeaderBytes.Length); return(ByteUtil.Combine( requestSequenceBytes, requestCodeBytes, requestTypeBytes, requestTimeBytes, requestHeaderLengthBytes, requestHeaderBytes, responseCodeBytes, responseTimeBytes, responseHeaderLengthBytes, responseHeaderBytes, response.ResponseBody)); }
private static byte[] BuildRemotingServerMessage(RemotingResponse remotingResponse) { byte[] remotingResponseData = RemotingUtil.BuildResponseMessage(remotingResponse); var remotingServerMessage = new RemotingServerMessage( RemotingServerMessageType.RemotingResponse, 100, remotingResponseData, null); return(RemotingUtil.BuildRemotingServerMessage(remotingServerMessage)); }
/// <summary> /// 判断反馈内容是否为空的 /// </summary> /// <param name="remotingResponse"></param> /// <returns></returns> public static bool IsEmptyBody(this RemotingResponse remotingResponse) { return(remotingResponse == null || remotingResponse.ResponseBody == null || remotingResponse.ResponseBody.Length == 0); }
public bool SetResponse(RemotingResponse response) { return(_taskSource.TrySetResult(response)); }