VB.NET

Port Scanner

2014.07.29

* Imports System.Net.Sockets
Public Class Form1

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
TextBox1.Text += 1
Try
Dim Range As TcpClient = New TcpClient("192.168.0.1", TextBox1.Text)
If Range.Connected = True Then
ListBox1.Items.Add(TextBox1.Text & " is Open")
End If
Catch ex As Exception
ListBox1.Items.Add(TextBox1.Text & " is Closed")
ListBox1.SelectedIndex = ListBox1.SelectedIndex + 1
End Try
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
End Sub
End Class 



해당 IP 포트의 Open/Close를 보여주는 코드 이다


aa.png