Bewerken

Delen via


HttpClientChannel.CreateMessageSink(String, Object, String) Method

Definition

Returns a channel message sink that delivers messages to the specified URL or channel data object.

public:
 virtual System::Runtime::Remoting::Messaging::IMessageSink ^ CreateMessageSink(System::String ^ url, System::Object ^ remoteChannelData, [Runtime::InteropServices::Out] System::String ^ % objectURI);
public virtual System.Runtime.Remoting.Messaging.IMessageSink CreateMessageSink (string url, object remoteChannelData, out string objectURI);
abstract member CreateMessageSink : string * obj * string -> System.Runtime.Remoting.Messaging.IMessageSink
override this.CreateMessageSink : string * obj * string -> System.Runtime.Remoting.Messaging.IMessageSink
Public Overridable Function CreateMessageSink (url As String, remoteChannelData As Object, ByRef objectURI As String) As IMessageSink

Parameters

url
String

The URL to which the new sink will deliver messages. Can be null.

remoteChannelData
Object

The channel data object of the remote host to which the new sink will deliver messages. Can be null.

objectURI
String

When this method returns, contains a URI of the new channel message sink that delivers messages to the specified URL or channel data object. This parameter is passed uninitialized.

Returns

A channel message sink that delivers messages to the specified URL or channel data object.

Implements

Examples

The following code example shows how to use the CreateMessageSink property. This code example is part of a larger example provided for the HttpClientChannel class.

// Create a message sink.
String^ objectUri;
System::Runtime::Remoting::Messaging::IMessageSink^ messageSink = clientChannel->CreateMessageSink( L"http://localhost:9090/RemoteObject.rem", nullptr,  objectUri );
Console::WriteLine( L"The URI of the message sink is {0}.", objectUri );
if ( messageSink != nullptr )
{
   Console::WriteLine( L"The type of the message sink is {0}.", messageSink->GetType() );
}
// Create a message sink.
string objectUri;
System.Runtime.Remoting.Messaging.IMessageSink messageSink =
    clientChannel.CreateMessageSink(
    "http://localhost:9090/RemoteObject.rem",
    null, out objectUri);
Console.WriteLine(
    "The URI of the message sink is {0}.",
    objectUri);
if (messageSink != null)
{
    Console.WriteLine("The type of the message sink is {0}.",
        messageSink.GetType().ToString());
}

Remarks

The CreateMessageSink method returns a channel message sink that delivers messages to either the specified URL or the channel data object. If the uri parameter is null, remoteChannelData is used as a target for the sink. Either the url or remoteChannelData parameters can be null, but not both.

Applies to