IChannelDataStoreとは? わかりやすく解説

IChannelDataStore インターフェイス

リモート処理チャネルチャネル データ格納します

名前空間: System.Runtime.Remoting.Channels
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<ComVisibleAttribute(True)> _
Public Interface IChannelDataStore
Dim instance As IChannelDataStore
[ComVisibleAttribute(true)] 
public interface IChannelDataStore
[ComVisibleAttribute(true)] 
public interface class IChannelDataStore
/** @attribute ComVisibleAttribute(true) */ 
public interface IChannelDataStore
ComVisibleAttribute(true) 
public interface IChannelDataStore
解説解説
使用例使用例
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
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Runtime.Remoting.Services;
using System.Security.Permissions;

public class ServerProcess
{
   [PermissionSet(SecurityAction.LinkDemand)]
   public static void Main()
   {

      TcpChannel myChannel = new TcpChannel(8085);
      ChannelServices.RegisterChannel(myChannel);

      MyServiceClass myService  = new MyServiceClass();

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

      // Get the information contributed by active channel.
      IChannelInfo myChannelInfo = myObjRef.ChannelInfo;
      IChannelDataStore myIChannelData;
      foreach(object myChannelData in myChannelInfo.ChannelData)
      {
         if(myChannelData is IChannelDataStore)
         {
            myIChannelData = (IChannelDataStore)myChannelData;
            foreach(string myUri in
 myIChannelData.ChannelUris)
               Console.WriteLine("Channel Uris are -> " + myUri);
            // Add custom data.
            string myKey = "Key1";
            myIChannelData[myKey] = "My Data";
            Console.WriteLine(myIChannelData[myKey].ToString());
         }
      }

   }
}

// Marshal ByRef Object class.
public class MyServiceClass : MarshalByRefObject
{
   public string HelloWorld()
   {
      return "Hello World";
   }
}
#using <System.Runtime.Remoting.dll>
#using <System.dll>

using namespace System;
using namespace System::Runtime::Remoting;
using namespace System::Runtime::Remoting::Channels;
using namespace System::Runtime::Remoting::Channels::Tcp;
using namespace System::Runtime::Remoting::Services;

// Marshal ByRef Object class.
public ref class MyServiceClass: public
 MarshalByRefObject
{
public:
   String^ HelloWorld()
   {
      return "Hello World";
   }
};

int main()
{
   TcpChannel^ myChannel = gcnew TcpChannel( 8085 );
   ChannelServices::RegisterChannel( myChannel );
   MyServiceClass^ myService = gcnew MyServiceClass;
   
   // After the channel is registered, register the object
   // with remoting infrastructure by calling Marshal method.
   ObjRef^ myObjRef = RemotingServices::Marshal( myService, "TcpService"
 );
   
   // Get the information contributed by active channel.
   IChannelInfo^ myChannelInfo = myObjRef->ChannelInfo;
   IChannelDataStore^ myIChannelData;
   System::Collections::IEnumerator^ myEnum = myChannelInfo->ChannelData->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      Object^ myChannelData = safe_cast<Object^>(myEnum->Current);
      if ( dynamic_cast<IChannelDataStore^>(myChannelData)
 )
      {
         myIChannelData = dynamic_cast<IChannelDataStore^>(myChannelData);
         System::Collections::IEnumerator^ myEnum1 = myIChannelData->ChannelUris->GetEnumerator();
         while ( myEnum1->MoveNext() )
         {
            String^ myUri = safe_cast<String^>(myEnum1->Current);
            Console::WriteLine( "Channel Uris are -> {0}", myUri );
         }
         String^ myKey = "Key1";
         myIChannelData[ myKey ] = "My Data";
         Console::WriteLine( myIChannelData[ myKey ] );
      }
   }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
IChannelDataStore メンバ
System.Runtime.Remoting.Channels 名前空間

IChannelDataStore プロパティ


IChannelDataStore メンバ



このページでは「.NET Framework クラス ライブラリ リファレンス」からIChannelDataStoreを検索した結果を表示しています。
Weblioに収録されているすべての辞書からIChannelDataStoreを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からIChannelDataStore を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「IChannelDataStore」の関連用語

IChannelDataStoreのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



IChannelDataStoreのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS