Imports System.Net
Imports System.Net.Sockets
Imports System.Text
Public Class Tester
Public Shared Sub Main
Try
Dim dataSend() As Byte
Dim myUdpClient As UdpClient
myUdpClient = New UdpClient("127.0.0.1", 12345)
''dataSend = Encoding.ASCII.GetBytes(SendMessage)
dataSend = Encoding.Unicode.GetBytes("SendMessage")
myUdpClient.Send(dataSend, dataSend.Length)
myUdpClient.Close()
Catch e As Exception
Console.WriteLine(e.Message)
End Try
End Sub
End Class
|