當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。