本文整理匯總了C#中System.Runtime.Remoting.Channels.IServerChannelSink接口的典型用法代碼示例。如果您正苦於以下問題:C# IServerChannelSink接口的具體用法?C# IServerChannelSink怎麽用?C# IServerChannelSink使用的例子?那麽, 這裏精選的接口代碼示例或許可以為您提供幫助。
IServerChannelSink接口屬於System.Runtime.Remoting.Channels命名空間,在下文中一共展示了IServerChannelSink接口的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 ServerSink : BaseChannelSinkWithProperties, IServerChannelSink
{
// This class inherits from BaseChannelSinkWithPropertes
// to get an implementation of IChannelSinkBase.
// The next sink in the chain.
private IServerChannelSink nextSink;
public IServerChannelSink NextChannelSink
{
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
get
{
return(nextSink);
}
}
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
public Stream GetResponseStream (IServerResponseChannelSinkStack sinkStack,
Object state,
IMessage message,
ITransportHeaders responseHeaders)
{
return(null);
}
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
public ServerProcessing ProcessMessage (IServerChannelSinkStack sinkStack,
IMessage requestMessage,
ITransportHeaders requestHeaders,
Stream requestStream,
out IMessage responseMessage,
out ITransportHeaders responseHeaders,
out Stream responseStream)
{
// Hand off to the next sink for processing.
sinkStack.Push(this, null);
ServerProcessing status = nextSink.ProcessMessage(
sinkStack, requestMessage, requestHeaders, requestStream,
out responseMessage, out responseHeaders, out responseStream
);
// Print the response message properties.
Console.WriteLine("---- Message from the server ----");
IDictionary dictionary = responseMessage.Properties;
foreach (Object key in dictionary.Keys)
{
Console.WriteLine("{0} = {1}", key, dictionary[key]);
}
Console.WriteLine("---------------------------------");
return(status);
}
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
public void AsyncProcessResponse (IServerResponseChannelSinkStack sinkStack,
Object state,
IMessage message,
ITransportHeaders responseHeaders,
Stream responseStream)
{
throw new NotImplementedException();
}
// Constructor
[SecurityPermission(SecurityAction.LinkDemand)]
public ServerSink (IServerChannelSink sink) {
if (sink == null) throw new ArgumentNullException("sink");
nextSink = sink;
}
}