Imports System.Net
Imports System.Net.Sockets
Imports System.Text
Public Class Tester
Public Shared Sub Main
Try
Dim bteDataAccept() As Byte
Dim strdataAccept As String = ""
Dim myEndPoint As New IPEndPoint(IPAddress.Parse("127.0.0.1"), 12345)
Dim myByte(36000) As Byte
Dim myUdpClient As UdpClient = New UdpClient(12345)
myByte = myUdpClient.Receive(myEndPoint)
'' strdataAccept = Encoding.ASCII.GetString(myByte)
strdataAccept = Encoding.Unicode.GetString(myByte)
Console.WriteLine(strdataAccept)
myUdpClient.Close()
Catch e As Exception
Console.WriteLine(e.Message)
End Try
End Sub
End Class
|