Imports System
Imports System.Net
Imports System.Net.Sockets
Imports System.Text
Public Class Tester
Public Shared Sub Main
Dim MyIP As IPAddress
Dim bytes(200) As Byte
Dim Port1 As Integer = 8080
Dim port2 As Integer = 3128
MyIP = IPAddress.Parse("166.111.175.81")
Dim myLocal As New IPEndPoint(MyIP, Port1)
Dim myRemote As New IPEndPoint(MyIP, port2)
Dim receive1 As New UdpClient(myRemote)
Dim send1 As New UdpClient(myLocal)
Try
bytes = System.Text.Encoding.ASCII.GetBytes("AAA")
send1.Send(bytes, bytes.Length, myRemote)
receive1.Receive(myLocal)
Catch ex As Exception
Console.WriteLine("Error")
End Try
send1.Close()
receive1.Close()
End Sub
End Class
|