Imports System.Net.Sockets Imports System.Net Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.CheckForIllegalCrossThreadCalls = False 'Now you can Add items through a thread For i As Integer = NumericUpDown1.Value To NumericUpDown2.Value Dim tmpThread As New System.Threading.Thread(AddressOf ScanPort) tmpThread.IsBackground = True tmpThread.Start(i) 'i represents the current port Next End Sub Private Sub ScanPort(ByVal port As Integer) Try 'Always put your code [or more complicated code] in a Try Catch Block :] Dim tmpClient As New TcpClient() Dim tmpEndPoint As New IPEndPoint(IPAddress.Parse(TextBox1.Text), port) tmpClient.Connect(tmpEndPoint) Threading.Thread.Sleep(50) '50 is the Timeout in ms. If tmpClient.Connected = True Then ListBox1.Items.Add("Open Port: " & port) 'If Connected then it will be an open port End If Catch ex As Exception End Try End Sub End Class
Memaparkan catatan dengan label NET. Papar semua catatan
Memaparkan catatan dengan label NET. Papar semua catatan
Ahad, September 22, 2013
VB.NET : Port Scanner
Langgan:
Catatan (Atom)