本文整理汇总了C#中System.Runtime.Remoting.ActivatedClientTypeEntry类的典型用法代码示例。如果您正苦于以下问题:C# ActivatedClientTypeEntry类的具体用法?C# ActivatedClientTypeEntry怎么用?C# ActivatedClientTypeEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActivatedClientTypeEntry类属于System.Runtime.Remoting命名空间,在下文中一共展示了ActivatedClientTypeEntry类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
//引入命名空间
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
public class MyClient
{
public static void Main()
{
// Register TCP Channel.
ChannelServices.RegisterChannel(new TcpChannel());
// Create activated client type entry.
ActivatedClientTypeEntry myActivatedClientTypeEntry =
new ActivatedClientTypeEntry(typeof(HelloServer),
"tcp://localhost:8082");
// Register type on client to activate it on the server.
RemotingConfiguration.RegisterActivatedClientType(
myActivatedClientTypeEntry);
// Activate a client activated object type.
HelloServer myHelloServer = new HelloServer("ParameterString");
// Print the object type.
Console.WriteLine(
"Object type of client activated object: " +
myActivatedClientTypeEntry.ObjectType.ToString());
// Print the application URL.
Console.WriteLine(
"Application url where the type is activated: " +
myActivatedClientTypeEntry.ApplicationUrl);
// Print the string representation of the type entry.
Console.WriteLine(
"Type name, assembly name and application URL " +
"of the remote object: " +
myActivatedClientTypeEntry.ToString());
// Print a blank line.
Console.WriteLine();
// Check that server was located.
if (myHelloServer == null)
{
Console.WriteLine("Could not locate server");
}
else
{
Console.WriteLine("Calling remote object");
Console.WriteLine(myHelloServer.HelloMethod("Bill"));
}
}
}
示例2: Main
//引入命名空间
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
public class MyServer
{
public static void Main()
{
ChannelServices.RegisterChannel(new TcpChannel(8082));
RemotingConfiguration.RegisterActivatedServiceType(typeof(HelloServer));
Console.WriteLine("Press enter to stop this process");
Console.ReadLine();
}
}
示例3: HelloServer
//引入命名空间
using System;
public class HelloServer : MarshalByRefObject
{
public HelloServer(String myString)
{
Console.WriteLine("HelloServer activated");
Console.WriteLine("Parameter passed to the constructor is "+myString);
}
public String HelloMethod(String myName)
{
Console.WriteLine("HelloMethod : {0}",myName);
return "Hi there " + myName;
}
}