TcpChannel.CreateMessageSink Method

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

Namespace:  System.Runtime.Remoting.Channels.Tcp
Assembly:  System.Runtime.Remoting (in System.Runtime.Remoting.dll)

[SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, 
	Infrastructure = true)]
public IMessageSink CreateMessageSink(
	string url,
	Object remoteChannelData,
	out string objectURI
)

Parameters

url
Type: System.String

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

remoteChannelData
Type: System.Object

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

objectURI
Type: System.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.

Return Value

Type: System.Runtime.Remoting.Messaging.IMessageSink
A channel message sink that delivers messages to the specified URL or channel data object.

Implements

IChannelSender.CreateMessageSink(String, Object, String)

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.

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());
}

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft