TcpServerChannel.GetUrlsForUri Method (String)

 

Returns an array of all the URLs for an object with the specified URI, hosted on the current TcpChannel instance.

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

[SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, 
	Infrastructure = true)]
public virtual string[] GetUrlsForUri(
	string objectUri
)

Parameters

objectUri
Type: System.String

The URI of the object for which URLs are required.

Return Value

Type: System.String[]

An array of the URLs for an object with the specified URI, hosted on the current TcpChannel instance.

The following code example shows the use of the GetUrlsForUri method.

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);

   }
}

.NET Framework
Available since 1.1
Return to top
Show: