本文整理汇总了C#中System.Runtime.Remoting.Channels.IClientChannelSink接口的典型用法代码示例。如果您正苦于以下问题:C# IClientChannelSink接口的具体用法?C# IClientChannelSink怎么用?C# IClientChannelSink使用的例子?那么恭喜您, 这里精选的接口代码示例或许可以为您提供帮助。
IClientChannelSink接口属于System.Runtime.Remoting.Channels命名空间,在下文中一共展示了IClientChannelSink接口的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: return
//引入命名空间
using System;
using System.Collections;
using System.IO;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Messaging;
using System.Security.Permissions;
public class ClientSink : BaseChannelSinkWithProperties, IClientChannelSink
{
// This class inherits from BaseChannelSinkWithPropertes
// to get an implementation of IChannelSinkBase.
// The next sink in the chain.
private IClientChannelSink nextSink;
public IClientChannelSink NextChannelSink
{
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
get
{
return(nextSink);
}
}
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
public Stream GetRequestStream (IMessage message, ITransportHeaders requestHeaders)
{
// Get the request stream from the next sink in the chain.
return( nextSink.GetRequestStream(message, requestHeaders) );
}
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
public void ProcessMessage (IMessage message,
ITransportHeaders requestHeaders,
Stream requestStream,
out ITransportHeaders responseHeaders,
out Stream responseStream)
{
// Print the request message properties.
Console.WriteLine("---- Message from the client ----");
IDictionary dictionary = message.Properties;
foreach (Object key in dictionary.Keys)
{
Console.WriteLine("{0} = {1}", key, dictionary[key]);
}
Console.WriteLine("---------------------------------");
// Hand off to the next sink in the chain.
nextSink.ProcessMessage(message, requestHeaders, requestStream, out responseHeaders, out responseStream);
}
// For synchronous remoting, it is not necessary to implement this method.
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
public void AsyncProcessRequest (IClientChannelSinkStack sinkStack,
IMessage message,
ITransportHeaders requestHeaders,
Stream requestStream)
{
throw new NotImplementedException();
}
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
public void AsyncProcessResponse (IClientResponseChannelSinkStack sinkStack,
Object state,
ITransportHeaders responseHeaders,
Stream responseStream)
{
throw new NotImplementedException();
}
// Constructor
[SecurityPermission(SecurityAction.LinkDemand)]
public ClientSink (IClientChannelSink sink) {
if (sink == null) throw new ArgumentNullException("sink");
nextSink = sink;
}
}