HomeClick here for more advertising information!
Latest Forum Posts
Newegg coming to Canada by shc-boomer
posted 9 minutes ago, with 1 replies.

Acer Aspireone by shc-boomer
posted 2 hours and 39 minutes ago, with 14 replies.

CoD4 Multiplayer by shc-boomer
posted 3 hours and 14 minutes ago, with 48 replies.

Post your computer + accessories photos by shc-boomer
posted 3 hours and 29 minutes ago, with 907 replies.

CoD4 PS3 on HDTV by lukerman
posted 8 hours and 45 minutes ago, with 11 replies.

[Funny Video] Yo Gabba Gabba Tummy Song ... by Mindovermaster
posted 15 hours and 21 minutes ago, with 1 replies.

[Newegg] Hard Drive Extravaganza (Free S... by Mindovermaster
posted 23 hours and 44 minutes ago, with 3 replies.

FAQ : how to convert dvd and video to zu... by chconline
posted 1 day and 0 hour ago, with 2 replies.

FAQ : how to rip DVD and convert Video t... by Agent47
posted 1 day and 13 hours ago, with 4 replies.

Lol Link in Box name ripoff by Mindovermaster
posted 1 day and 19 hours ago, with 7 replies.


Forum Login

Forum Login | Register

Click here to login only if you are using specific APH Main facilities (Forum and APH Main accounts are separate). Otherwise, register or login to our forums using links provided above.


Support APH Networks

Running APH Networks requires lots of time and money. (Please see our 2008 Monthly Budget.) If you appreciate our hard work and want to support us financially, any amount you donate is greatly appreciated for us to continue! Click here for more info.


Who's online
There are currently 2 users and 2337 guests online.

Tutorials | VB6 Port Scanner

Tutorials | VB6 Port Scanner
Submitted by chconline on Thursday, December 8, 2005 - 13:51 Tutorials

Author: Lord Nikon
December 8, 2005

To make the port scanner, start of by making a standard EXE. Press CTRL+T, choose Microsoft Winsock Control 6.0 from the list.

Add some controls to your program so it looks like this:

In the Start Timer's timer event add this code:

Private Sub Timer1_Timer()
On Error Resume Next
Winsock1.Close
txtPort.Text = Int(txtPort.Text) + 1
Winsock1.RemoteHost = txtHost.Text
Winsock1.RemotePort = txtPort.Text
lblPort.Caption = Winsock1.RemotePort
Winsock1.Connect
End Sub

What this does is that it specifies our Winsock's remote host and remote port as the text boxes we creates. txtPort.Text = Int(txtPort.Text) + 1 simply means that we want the port number to increase by 1 each time a port is scanned. Then we display the Host's port in the label lblPort.

In the Start button add this code:

Private Sub cmdStart_Click()
Timer1.Interval = 1
Timer1.Enabled = True
End Sub

This sets the timer's interval to 1 millisecond, and enables the timer so all the code in the timer is executed in a loop.

In the Stop button add this code:

Private Sub cmdStop_Click()
Timer1.Enabled = False
txtPort.Text = "0"
End Sub

This code disables timer1 so the loop is broken and resets the info.

In Winsock's Connect event add this code:

Private Sub Winsock1_Connect()
lstLog.AddItem (Winsock1.RemotePort & " is open")
End Sub

This just lists each open port to the list box everytime Winsock successfully connects to an open port.

In the formload event add this code:

Private Sub Form_Load()
txtHost.Text = Winsock1.LocalIP
txtPort.Text = Winsock1.LocalPort
End Sub

This places the computer's IP in the IP text box and the port in the port text box.

And finally in the form UNload event add this code:

Private Sub Form_Unload(Cancel As Integer)
End
End Sub

This is just to make sure the processes or our program doesn't keep running after the user had closed the program.

Run the program and if you did everything right you should get results like this:

Download: Sample Program


Poll




Sponsored Ads





:: Copyright 1998-2008 APH Networks. :: Copyright | Privacy Policy ::
This site is best viewed when your monitor's resolution is set to 1024x768 or higher.
Currently running on APH.CMS.