本文整理汇总了VB.NET中System.Runtime.Remoting.Channels.IChannelSender接口的典型用法代码示例。如果您正苦于以下问题:VB.NET IChannelSender接口的具体用法?VB.NET IChannelSender怎么用?VB.NET IChannelSender使用的例子?那么恭喜您, 这里精选的接口代码示例或许可以为您提供帮助。
在下文中一共展示了IChannelSender接口的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
开发者ID:VB.NET开发者,项目名称:System.Runtime.Remoting.Channels,代码行数:47,代码来源:IChannelSender
注:本文中的System.Runtime.Remoting.Channels.IChannelSender接口示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论