Export (0) Print
Expand All

IChannelDataStore Interface

Stores channel data for the remoting channels.

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

'Declaration
<ComVisibleAttribute(True)> _
Public Interface IChannelDataStore
'Usage
Dim instance As IChannelDataStore

/** @attribute ComVisibleAttribute(true) */ 
public interface IChannelDataStore
ComVisibleAttribute(true) 
public interface IChannelDataStore

Channels that want to use the channel sink architecture must implement this interface on their ChannelData object.

Imports System
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Tcp
Imports System.Runtime.Remoting.Services
Imports System.Security.Permissions

Public Class ServerProcess
   <PermissionSet(SecurityAction.LinkDemand)> _
   Public Shared Sub Main()
      Dim myChannel As New TcpChannel(8085)
      ChannelServices.RegisterChannel(myChannel)

      Dim myService As New MyServiceClass()

      ' After the channel is registered, register the object
      ' with remoting infrastructure by calling Marshal method.
      Dim myObjRef As ObjRef = RemotingServices.Marshal(myService, "TcpService")

      ' Get the information contributed by active channel.
      Dim myChannelInfo As IChannelInfo = myObjRef.ChannelInfo
      Dim myIChannelData As IChannelDataStore
      Dim myChannelData As Object
      For Each myChannelData In  myChannelInfo.ChannelData
         If TypeOf myChannelData Is IChannelDataStore Then
            myIChannelData = CType(myChannelData, IChannelDataStore)
            Dim myUri As String
            For Each myUri In  myIChannelData.ChannelUris
               Console.WriteLine("Channel Uris are -> " + myUri)
            Next myUri ' Add custom data.
            Dim myKey As String = "Key1"
            myIChannelData(myKey) = "My Data"
            Console.WriteLine(myIChannelData(myKey).ToString())
         End If
      Next myChannelData
   End Sub 'Main
End Class 'ServerProcess

' Marshal ByRef Object class.
Public Class MyServiceClass
   Inherits MarshalByRefObject

   Public Function HelloWorld() As String
      Return "Hello World"
   End Function 'HelloWorld
End Class 'MyServiceClass

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