Export (0) Print
Expand All

BaseChannelObjectWithProperties Constructor

Initializes a new instance of the BaseChannelObjectWithProperties class.

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

protected BaseChannelObjectWithProperties ()
protected BaseChannelObjectWithProperties ()
protected function BaseChannelObjectWithProperties ()

   [PermissionSet(SecurityAction.Demand, Name="FullTrust")]
   public class LoggingServerChannelSinkProvider : IServerChannelSinkProvider
   {
      private IServerChannelSinkProvider next2 = null;
      public LoggingServerChannelSinkProvider(IDictionary properties, ICollection providerData)
      {
      }
      public void GetChannelData(IChannelDataStore channelData)
      {
      }
      public IServerChannelSink CreateSink(IChannelReceiver channel1)
      {
         IServerChannelSink localNextSink = null;
         if (next2 != null)
            localNextSink = next2.CreateSink(channel1);
         return new LoggingServerChannelSink(localNextSink);
      }
      public IServerChannelSinkProvider Next
      {
         get
         {
            return next2;
         }
         set
         {
            next2 = value;
         }
      }
   }
   [PermissionSet(SecurityAction.Demand, Name="FullTrust")]
   internal class LoggingServerChannelSink : BaseChannelObjectWithProperties, IServerChannelSink
   {
      private IServerChannelSink nextSink2 = null;
      private bool bEnabled2 = true;
      public LoggingServerChannelSink(IServerChannelSink localNextSink) : base()
      {
         nextSink2 = localNextSink;
      }
      public ServerProcessing ProcessMessage(   IServerChannelSinkStack sinkStack,
   IMessage requestMsg,
   ITransportHeaders requestHeaders,
   Stream requestStream,
   out IMessage responseMsg,
   out ITransportHeaders responseHeaders,
   out Stream responseStream
)
      {
         if (bEnabled2)
         {
            Console.WriteLine("----------Request Headers-----------");
            Console.WriteLine( CommonTransportKeys.IPAddress + ":" +
               requestHeaders[CommonTransportKeys.IPAddress]);
            Console.WriteLine( CommonTransportKeys.ConnectionId + ":" +
               requestHeaders[CommonTransportKeys.ConnectionId]);
            Console.WriteLine( CommonTransportKeys.RequestUri + ":" +
               requestHeaders[CommonTransportKeys.RequestUri]);

         }
         sinkStack.Push(this, null);
         ServerProcessing processing =
            nextSink2.ProcessMessage(sinkStack, requestMsg, requestHeaders, requestStream, out responseMsg,
            out responseHeaders, out responseStream);

         switch (processing)
         {
            case ServerProcessing.Complete :
            {
               sinkStack.Pop(this);
               break;
            }
            case ServerProcessing.OneWay:
            {
               sinkStack.Pop(this);
               break;
            }
            case ServerProcessing.Async:
            {
               sinkStack.Store(this, null);
               break;
            }
         }
         return processing;
      }
      public void AsyncProcessResponse(IServerResponseChannelSinkStack sinkStack, Object state,
         IMessage msg, ITransportHeaders headers, Stream stream1)
      {
         sinkStack.AsyncProcessResponse(msg, headers, stream1);
      }
      public Stream GetResponseStream(IServerResponseChannelSinkStack sinkStack, Object state,
         IMessage msg, ITransportHeaders headers)
      {
         return null;
      }
      public IServerChannelSink NextChannelSink
      {
         get
         {
            return nextSink2;
         }
      }
   }

public class LoggingServerChannelSinkProvider
    implements IServerChannelSinkProvider
{
    private IServerChannelSinkProvider next2 = null;

    public LoggingServerChannelSinkProvider(IDictionary properties,
        ICollection providerData)
    {
    } //LoggingServerChannelSinkProvider

    public void GetChannelData(IChannelDataStore channelData)
    {
    } //GetChannelData

    public IServerChannelSink CreateSink(IChannelReceiver channel1)
    {
        IServerChannelSink localNextSink = null;
        if (next2 != null) {
            localNextSink = next2.CreateSink(channel1);
        }
        return new LoggingServerChannelSink(localNextSink);
    } //CreateSink

    /** @property 
     */
    public IServerChannelSinkProvider get_Next()
    {
        return next2;
    } //get_Next

    /** @property 
     */
    public void set_Next(IServerChannelSinkProvider value)
    {
        next2 = value;
    } //set_Next
} //LoggingServerChannelSinkProvider

class LoggingServerChannelSink extends BaseChannelObjectWithProperties
   implements IServerChannelSink
{
    private IServerChannelSink nextSink2 = null;
    private boolean bEnabled2 = true;

    public LoggingServerChannelSink(IServerChannelSink localNextSink)
    {
        nextSink2 = localNextSink;
    } //LoggingServerChannelSink

    public ServerProcessing ProcessMessage(IServerChannelSinkStack sinkStack,
        IMessage requestMsg, ITransportHeaders requestHeaders,
        Stream requestStream,
        /**@ref
         */IMessage responseMsg,
        /**@ref
         */ITransportHeaders responseHeaders,
        /**@ref
         */Stream responseStream)
    {
        if (bEnabled2) {
            Console.WriteLine("----------Request Headers-----------");
            Console.WriteLine(CommonTransportKeys.IPAddress + ":"
                + requestHeaders.get_Item(CommonTransportKeys.IPAddress));
            Console.WriteLine(CommonTransportKeys.ConnectionId + ":"
                + requestHeaders.get_Item(CommonTransportKeys.ConnectionId));

            Console.WriteLine(CommonTransportKeys.RequestUri + ":"
                + requestHeaders.get_Item(CommonTransportKeys.RequestUri));
        }

        sinkStack.Push(this, null);
        ServerProcessing processing =
            nextSink2.ProcessMessage(sinkStack, requestMsg, requestHeaders,
            requestStream, responseMsg, responseHeaders, responseStream);
        switch (processing) {
            case ServerProcessing.Complete :
                sinkStack.Pop(this);
                break;
            case ServerProcessing.OneWay :
                sinkStack.Pop(this);
                break;
            case ServerProcessing.Async :
                sinkStack.Store(this, null);
                break;
        }
        return processing;
    } //ProcessMessage

    public void AsyncProcessResponse(IServerResponseChannelSinkStack sinkStack,
        Object state, IMessage msg, ITransportHeaders headers, Stream stream1)
    {
        sinkStack.AsyncProcessResponse(msg, headers, stream1);
    } //AsyncProcessResponse

    public Stream GetResponseStream(IServerResponseChannelSinkStack sinkStack,
        Object state, IMessage msg, ITransportHeaders headers)
    {
        return null;
    } //GetResponseStream

    /** @property 
     */
    public IServerChannelSink get_NextChannelSink()
    {
        return nextSink2;
    }//get_NextChannelSink
} //LoggingServerChannelSink

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft