本文整理汇总了VB.NET中System.Runtime.Remoting.Channels.IChannelSender.CreateMessageSink方法的典型用法代码示例。如果您正苦于以下问题:VB.NET IChannelSender.CreateMessageSink方法的具体用法?VB.NET IChannelSender.CreateMessageSink怎么用?VB.NET IChannelSender.CreateMessageSink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Runtime.Remoting.Channels.IChannelSender
的用法示例。
在下文中一共展示了IChannelSender.CreateMessageSink方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: MyClient
' 导入命名空间
Imports System.Collections
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Messaging
Imports System.Runtime.Remoting.Channels.Http
Imports System.Security.Permissions
Public Class MyClient
<PermissionSet(SecurityAction.LinkDemand)> _
Public Shared Sub Main()
Try
' Create the 'IDictionary' to set the server object properties.
Dim myDictionary As New Hashtable()
myDictionary("name") = "HttpClientChannel"
myDictionary("priority") = 2
' Set the properties along with the constructor.
Dim myIChannelSender As New HttpClientChannel(myDictionary, _
New BinaryClientFormatterSinkProvider())
' Register the server channel.
ChannelServices.RegisterChannel(myIChannelSender)
Dim myHelloServer1 As MyHelloServer = CType(Activator.GetObject(GetType(MyHelloServer), _
"http://localhost:8085/SayHello"), MyHelloServer)
If myHelloServer1 Is Nothing Then
Console.WriteLine("Could not locate server")
Else
Console.WriteLine(myHelloServer1.myHelloMethod("Client"))
' Get the name of the channel.
Console.WriteLine("Channel Name :" + myIChannelSender.ChannelName)
' Get the channel priority.
Console.WriteLine("ChannelPriority :" + myIChannelSender.ChannelPriority.ToString())
Dim myString As String = ""
Dim myObjectURI1 As String = ""
Console.WriteLine("Parse :" + myIChannelSender.Parse("http://localhost:8085/SayHello", _
myString) + myString)
' Get the channel message sink that delivers message to specified url.
Dim myIMessageSink As IMessageSink = _
myIChannelSender.CreateMessageSink("http://localhost:8085/NewEndPoint", _
Nothing, myObjectURI1)
Console.WriteLine("Channel message sink used :" + CType(myIMessageSink,Object).ToString())
Console.WriteLine("URI of new channel message sink :" + myObjectURI1)
End If
Catch ex As Exception
Console.WriteLine("Following exception is raised on client side : " + ex.Message)
End Try
End Sub
End Class