當前位置: 首頁>>代碼示例>>C#>>正文


C# IServerChannelSink接口代碼示例

本文整理匯總了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;
    }
}
開發者ID:.NET開發者,項目名稱:System.Runtime.Remoting.Channels,代碼行數:81,代碼來源:IServerChannelSink


注:本文中的System.Runtime.Remoting.Channels.IServerChannelSink接口示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。