/// <summary> /// Sends the content to the specified remote host and redirects a response to the callback. /// </summary> /// <param name="destination">The remote host.</param> /// <param name="serviceName">The name of the service.</param> /// <param name="content">The content.</param> /// <param name="iStreamResponseHandler">The response handler.</param> /// <param name="tag">The object that contains data about this invocation.</param> public void SendAsync(HostInformation destination, string serviceName, Stream content, IStreamResponseHandler iStreamResponseHandler, object tag) { // create the message Message message = new Message(this.ITransportContext, destination, 0, new TransportHeaders(), content); message.IsSynchronous = false; message.GenuineMessageType = GenuineMessageType.ExternalStreamConsumer; message.DestinationMarshalByRef = serviceName; message.Tag = tag; // register the response catcher UniversalAsyncResponseProcessor universalAsyncResponseProcessor = new UniversalAsyncResponseProcessor(message, null, iStreamResponseHandler); this.ITransportContext.IIncomingStreamHandler.RegisterResponseProcessor(message.MessageId, universalAsyncResponseProcessor); // and send the message this.ITransportContext.ConnectionManager.Send(message); }
/// <summary> /// Sends the content to the specified remote host and redirects a response to the callback. /// </summary> /// <param name="destination">The remote host.</param> /// <param name="serviceName">The name of the service.</param> /// <param name="content">The content.</param> /// <param name="iStreamResponseHandler">The response handler.</param> public void SendAsync(HostInformation destination, string serviceName, Stream content, IStreamResponseHandler iStreamResponseHandler) { this.SendAsync(destination, serviceName, content, iStreamResponseHandler, null); }
/// <summary> /// Initializes the instance of the UniversalAsyncResponseProcessor class. /// </summary> /// <param name="message">The source message.</param> /// <param name="streamResponseEventHandler">The response handler represented as a callback or a null reference.</param> /// <param name="iStreamResponseHandler">The response handler represented as a object supporting the IStreamResponseHandler interface or a null reference.</param> public UniversalAsyncResponseProcessor(Message message, StreamResponseEventHandler streamResponseEventHandler, IStreamResponseHandler iStreamResponseHandler) { this._message = message; this._streamResponseEventHandler = streamResponseEventHandler; this._iStreamResponseHandler = iStreamResponseHandler; }