本文整理汇总了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)
示例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