本文整理匯總了VB.NET中System.Runtime.Remoting.ActivatedClientTypeEntry類的典型用法代碼示例。如果您正苦於以下問題:VB.NET ActivatedClientTypeEntry類的具體用法?VB.NET ActivatedClientTypeEntry怎麽用?VB.NET ActivatedClientTypeEntry使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ActivatedClientTypeEntry類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: MyClient
' 導入命名空間
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Tcp
Public Class MyClient
Public Shared Sub Main()
' Register TCP Channel.
ChannelServices.RegisterChannel(New TcpChannel())
' Create activated client type entry.
Dim myActivatedClientTypeEntry As _
New ActivatedClientTypeEntry(GetType(HelloServer), _
"tcp://localhost:8082")
' Register type on client to activate it on the server.
RemotingConfiguration.RegisterActivatedClientType( _
myActivatedClientTypeEntry)
' Activate a client activated object type.
Dim myHelloServer As 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 Is Nothing Then
Console.WriteLine("Could not locate server")
Else
Console.WriteLine("Calling remote object")
Console.WriteLine(myHelloServer.HelloMethod("Bill"))
End If
End Sub
End Class
示例2: Main
' 導入命名空間
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Tcp
Public Class MyServer
Public Shared Sub Main()
ChannelServices.RegisterChannel(New TcpChannel(8082))
RemotingConfiguration.RegisterActivatedServiceType(GetType(HelloServer))
Console.WriteLine("Press enter to stop this process")
Console.ReadLine()
End Sub
End Class
示例3: New
Public Class HelloServer
Inherits MarshalByRefObject
Public Sub New(myString As String)
Console.WriteLine("HelloServer activated")
Console.WriteLine("Parameter passed to the constructor is " + myString)
End Sub
Public Function HelloMethod(myName As String) As String
Console.WriteLine("HelloMethod : {0}", myName)
Return "Hi there " + myName
End Function 'HelloMethod
End Class