本文整理匯總了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