Imports System.Net.Sockets
Imports System.Net
Imports System.Threading
Imports System.Text
Public Class Tester
Public Shared Sub Main
Dim intPortStart As Integer = 1
Dim intPortEnd As Integer = 10
Dim lngLoop As Long
For lngLoop = intPortStart To intPortEnd
Dim myTcpClient As New TcpClient()
Try
myTcpClient.Connect("127.0.0.1", lngLoop)
Console.WriteLine("Port " + lngLoop.ToString() + "started")
myTcpClient.Close()
Catch ex As SocketException
Console.WriteLine("Port " + lngLoop.ToString() + " Closed" + ex.Message)
End Try
Next
End Sub
End Class
|