public TResponse ReadAck <TResponse>(NamedPipeClientStream stream, int InBufferSize = 8192) { using (AckStream ack = AckStream.Read(stream, typeof(TResponse), InBufferSize)) { if ((int)ack.State > (int)MessageState.Ok) { throw new Exception(ack.Message); } return(ack.GetValue <TResponse>()); } }
/// <summary> /// Read response from server. /// </summary> /// <typeparam name="TResponse"></typeparam> /// <param name="stream"></param> /// <param name="readTimeout"></param> /// <param name="InBufferSize"></param> /// <returns></returns> public TResponse ReadAck <TResponse>(NetworkStream stream, int readTimeout, int InBufferSize) { using (AckStream ack = AckStream.Read(stream, typeof(TResponse), readTimeout, InBufferSize)) { if ((int)ack.State > (int)MessageState.Ok) { throw new MessageException(ack); } return(ack.GetValue <TResponse>()); } }