Imports System.Net
Imports System.Net.Sockets
Imports System.Text
Module Module1
Sub Main()
Const listenPort As Integer = 11000
Dim listener As New UdpClient(listenPort)
Dim groupEP As New IPEndPoint(IPAddress.Any, listenPort)
Dim done As Boolean = False
Try
While Not done
Console.WriteLine("Waiting for broadcast")
Dim bytes As Byte() = listener.Receive(groupEP)
Console.WriteLine("Received broadcast from {0} :", _
groupEP.ToString())
Console.WriteLine( _
Encoding.ASCII.GetString(bytes, 0, bytes.Length))
Console.WriteLine()
End While
Catch e As Exception
Console.WriteLine(e.ToString())
Finally
listener.Close()
End Try
End Sub
End Module
最新の画像もっと見る
最近の「FreeBSD」カテゴリーもっと見る
最近の記事
カテゴリー
バックナンバー
2012年
人気記事