当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET UdpClient.DropMulticastGroup方法代码示例

本文整理汇总了VB.NET中System.Net.Sockets.UdpClient.DropMulticastGroup方法的典型用法代码示例。如果您正苦于以下问题:VB.NET UdpClient.DropMulticastGroup方法的具体用法?VB.NET UdpClient.DropMulticastGroup怎么用?VB.NET UdpClient.DropMulticastGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Net.Sockets.UdpClient的用法示例。


在下文中一共展示了UdpClient.DropMulticastGroup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。

示例1:

' Send data to ClientTarget.
Console.WriteLine(ControlChars.Lf + "The ClientOriginator sent:" + ControlChars.Lf)
Send.OriginatorSendData(clientOriginator, m_ClientTargetdest)

' Receive data from ClientTarget
Ret = Receive.ReceiveUntilStop(clientOriginator)

' Stop the ClientTarget thread
m_t.Abort()

' Abandon the multicast group.
clientOriginator.DropMulticastGroup(m_GrpAddr)
开发者ID:VB.NET开发者,项目名称:System.Net.Sockets,代码行数:12,代码来源:UdpClient.DropMulticastGroup

示例2: Tester

' 导入命名空间
Imports System.Net.Sockets
Imports System.Text
Imports System.IO
Imports System.Net
Imports System.Threading
Public Class Tester

    Dim Shared GroupIP As IPAddress
    Dim Shared GroupEP As IPEndPoint
    Dim Shared ListenUdp As UdpClient

    Public Shared Sub Main
        Dim ListenThread As Thread
        ListenThread = New Thread(AddressOf BeginListen)
        ListenThread.Start()

'        ListenUdp.DropMulticastGroup(GroupIP)
'        ListenUdp.Close()
'        ListenThread.Abort()

    End Sub

    Private Shared Sub BeginListen()
        Dim bteReceiveData() As Byte
        Dim strReceiveData As String

        GroupIP = IPAddress.Parse("127.0.0.1")

        GroupEP = New IPEndPoint(GroupIP, 12345)
        ListenUdp = New UdpClient(12345)
        ListenUdp.JoinMulticastGroup(GroupIP)

        Do
            bteReceiveData = ListenUdp.Receive(GroupEP)
            strReceiveData = Encoding.Unicode.GetString(bteReceiveData)
            Console.WriteLine(strReceiveData)
        Loop

    End Sub
End Class
开发者ID:VB程序员,项目名称:System.Net.Sockets,代码行数:41,代码来源:UdpClient.DropMulticastGroup


注:本文中的System.Net.Sockets.UdpClient.DropMulticastGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。