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
Ahad, September 22, 2013
VB.NET : Port Scanner
Label:
NET,
Rangkaian,
VB,
Visual Studio
Langgan:
Catat Ulasan (Atom)
0 ulasan:
Catat Ulasan
Selamat datang ke 0x2013LΣΣT. Sekiranya anda mempunyai persoalan, pandangan, permintaan, bantuan, cadangan dan sebagainya. Tinggalkan pesanan anda ke dalam kotak komen. Terima kasih !
- http://0x2013.blogspot.com -