public StreamingResponse <TResponse> SendRequest(TRequest message) { StreamingRequest <TRequest> request = new StreamingRequest <TRequest> { Message = message }; SendRequest(request); return(ReceiveResponse <StreamingResponse <TResponse> >(NetworkStream)); }
protected internal override void ReadRequest(TcpClient client) { while (client.Connected) { try { GetStreamData(client, out NetworkStream stream, out byte[] requestData); StreamingRequest <TRequest> request = requestData.FromBinaryBytes <StreamingRequest <TRequest> >(); StreamingContext <TRequest> ctx = new StreamingContext <TRequest> { Request = request, ResponseStream = stream, Encoding = Encoding }; TResponse response = ProcessRequest(ctx); WriteResponse(ctx, response); } catch (Exception ex) { Logger.AddEntry("Error reading request: {0}", ex, ex.Message); } } }