次の方法で共有


TcpServerChannel.GetUrlsForUri メソッド

指定した URI を持つオブジェクトのすべての URL のうち、現在の TcpChannel でホストされている URL の配列を返します。

Public Overridable Function GetUrlsForUri( _
   ByVal objectUri As String _) As String() Implements IChannelReceiver.GetUrlsForUri
[C#]
public virtual string[] GetUrlsForUri(stringobjectUri);
[C++]
public: virtual String* GetUrlsForUri(String* objectUri)  __gc[];
[JScript]
public function GetUrlsForUri(
   objectUri : String) : String[];

パラメータ

  • objectUri
    URL を要求するオブジェクトの URI。

戻り値

指定した URI を持つオブジェクトの URL のうち、現在の TcpChannel でホストされている URL の配列。

実装

IChannelReceiver.GetUrlsForUri

解説

このメソッドは、 ChannelServices.GetUrlsForObject によって使用されます。

使用例

 
Imports System
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels.Tcp


Class SampleClass
   
   Public Shared Sub Main()
      ' Create a remotable object.
      Dim tcpChannel As New TcpServerChannel(8085)
      
      Dim WKSTE As New WellKnownServiceTypeEntry(GetType(HelloService), "Service", WellKnownObjectMode.Singleton)
      RemotingConfiguration.RegisterWellKnownServiceType(WKSTE)
      
      RemotingConfiguration.ApplicationName = "HelloServer"
      
      ' Print out the urls for the HelloServer.
      Dim urls As String() = tcpChannel.GetUrlsForUri("HelloServer")
      Dim url As String
      
      For Each url In  urls
         System.Console.WriteLine("{0}", url)
      Next url 
   End Sub 'Main
   
End Class 'Class1

[C#] 
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels.Tcp;

class Class1 {
   public static void Main() {

      // Create a remotable object.
      TcpServerChannel tcpChannel = new TcpServerChannel(8085);

      WellKnownServiceTypeEntry WKSTE = 
         new WellKnownServiceTypeEntry(typeof(HelloService),
                                       "Service", 
                                       WellKnownObjectMode.Singleton);
      RemotingConfiguration.RegisterWellKnownServiceType(WKSTE);

      RemotingConfiguration.ApplicationName = "HelloServer";

      // Print out the urls for the HelloServer.
      string[] urls = tcpChannel.GetUrlsForUri("HelloServer");
      
      foreach (string url in urls)
         System.Console.WriteLine("{0}", url);
      
   }
}

[C++] 
#using <mscorlib.dll>
#using <system.dll>
#using <system.runtime.remoting.dll>

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

int main() 
{
    // Create a remotable object.
    TcpServerChannel* tcpChannel = new TcpServerChannel(8085);

    WellKnownServiceTypeEntry* WKSTE = new WellKnownServiceTypeEntry(__typeof(HelloService),
        S"Service", 
        WellKnownObjectMode::Singleton);

    RemotingConfiguration::RegisterWellKnownServiceType(WKSTE);

    RemotingConfiguration::ApplicationName = S"HelloServer";

    // Print out the urls for the HelloServer.
    String* urls __gc[] = tcpChannel->GetUrlsForUri(S"HelloServer");

    IEnumerator* myEnum = urls->GetEnumerator();

    while (myEnum->MoveNext())
    {
        String* url = __try_cast<String*>(myEnum->Current);

        System::Console::WriteLine(S"{0}", url);
    }
    return 0;
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

.NET Framework セキュリティ:

参照

TcpServerChannel クラス | TcpServerChannel メンバ | System.Runtime.Remoting.Channels.Tcp 名前空間