リモート処理チャネルのチャネル データを格納します。
この型のすべてのメンバの一覧については、IChannelDataStore メンバ を参照してください。
Public Interface IChannelDataStore
[C#]
public interface IChannelDataStore
[C++]
public __gc __interface IChannelDataStore
[JScript]
public interface IChannelDataStore
IChannelDataStore を実装するクラス
クラス | 説明 |
---|---|
ChannelDataStore | リモート処理チャネルのチャネル データを格納します。 |
解説
チャネル シンク アーキテクチャを使用するチャネルは、ChannelData オブジェクトにこのインターフェイスを実装する必要があります。
使用例
Imports System
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Tcp
Imports System.Runtime.Remoting.Services
Public Class ServerProcess
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
[C#]
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Runtime.Remoting.Services;
public class ServerProcess
{
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";
}
}
[C++]
#using <mscorlib.dll>
#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 __gc class MyServiceClass : public MarshalByRefObject
{
public:
String* HelloWorld()
{
return S"Hello World";
}
};
int 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,S"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 = __try_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 = __try_cast<String*>(myEnum1->Current);
Console::WriteLine(S"Channel Uris are -> {0}", myUri);
}
// Add custom data.
String* myKey = S"Key1";
myIChannelData->Item[myKey] = S"My Data";
Console::WriteLine(myIChannelData->Item[myKey]);
}
}
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
名前空間: System.Runtime.Remoting.Channels
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
アセンブリ: Mscorlib (Mscorlib.dll 内)
参照
IChannelDataStore メンバ | System.Runtime.Remoting.Channels 名前空間