當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET ActivatedClientTypeEntry類代碼示例

本文整理匯總了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
開發者ID:VB.NET開發者,項目名稱:System.Runtime.Remoting,代碼行數:49,代碼來源:ActivatedClientTypeEntry

示例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
開發者ID:VB.NET開發者,項目名稱:System.Runtime.Remoting,代碼行數:15,代碼來源:ActivatedClientTypeEntry

示例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
開發者ID:VB.NET開發者,項目名稱:System.Runtime.Remoting,代碼行數:13,代碼來源:ActivatedClientTypeEntry


注:本文中的System.Runtime.Remoting.ActivatedClientTypeEntry類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。