Editar

Compartilhar via


IpcClientChannel.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 delivers messages. This parameter can be null.

remoteChannelData
Object

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

objectURI
String

When this method returns, contains the 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

Exceptions

The provided sink does not implement IMessageSink.

Examples

The following code example shows how to use the CreateMessageSink method.

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