I want to scan my local ports and find open ones. how can I do this in VB.Net??
I want to find open portsÃÂ formÃÂ my Socket Listener.
I have this code - but it is too slow
Public Shared Sub Main()
Dim intPortStart As Integer = 100
Dim intPortEnd As Integer = 500
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
View Complete Post