Olvasás angol nyelven Szerkesztés

Megosztás a következőn keresztül:


TcpChannel.CreateMessageSink(String, Object, String) Method

Definition

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

public System.Runtime.Remoting.Messaging.IMessageSink CreateMessageSink (string url, object remoteChannelData, out string objectURI);

Parameters

url
String

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

remoteChannelData
Object

The channel data object of the remote host to which the new sink should 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 this method.

// Create a message sink.
string objectUri;
System.Runtime.Remoting.Messaging.IMessageSink messageSink =
    clientChannel.CreateMessageSink(
        "tcp://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 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.

Channel sinks provide a plug-in point that allows access to the underlying messages flowing through the channel as well as the stream used by the transport mechanism to send messages to a remote object. Channel sinks are linked together in a chain of ChannelSinkProviders and all channel messages flow through this chain of sinks before the message is finally serialized and transported.

Applies to

Termék Verziók
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1