borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Printing)Next Topic (Browser) New Topic New Poll Post Reply
AndreaVB Forum : Internet Applications : Port Scanner
Poster Message
Afshin_Zavar
Level: Sage

Registered: 17-07-2003
Posts: 64

icon Port Scanner

hi all coders
this is port scanner program, i've written.but there is error which i ca not solve it please help me soon.


Option Explicit
Dim cancel As Boolean

Private Sub CmndScan_Click()
Dim PortNumber As Long
  On Error Resume Next
  
  If (TxtFrom.Text <= TxtTo.Text) And Len(Trim(TxtIP.Text)) <> 0 Then
  TxtFrom.Locked = True: TxtTo.Locked = True: TxtIP.Locked = True
  CmndScan.Enabled = False: CmndStop.Enabled = True
  
  PortNumber = CLng(TxtFrom.Text)
    
    Do
      DoEvents
        Winsock1.Connect TxtIP.Text, TxtTo.Text
          Winsock1.LocalPort = PortNumber 'invalid operation in current state
             Winsock1.Listen
                If Err.Number > 0 Then
                   LstResult.AddItem "Error : " & Err.Description
                Else
                   LstResult.AddItem "Port" & PortNumber & " is available "
                End If
                 DoEvents
                   PortNumber = PortNumber + 1
                    If cancel = True Then Exit Do
    Loop Until (PortNumber >= TxtTo.Text)
    
  End If
    cancel = False
    TxtFrom.Locked = False: TxtTo.Locked = False: TxtIP.Locked = False
    Winsock1.Close
End Sub

Private Sub CmndStop_Click()

  CmndScan.Enabled = True: CmndStop.Enabled = False
  Winsock1.Close
  LstResult.Clear
  cancel = True
End Sub

Private Sub Form_Load()
cancel = False
End Sub


____________________________
Persia

26-08-2003 at 04:53 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1617
icon Re: Port Scanner

While I'm probably not going to go in depth with any responses to this...

You never said why or what the error is, not to mention some ports can't be connected to without causing problems anyway.

____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)

26-08-2003 at 06:22 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : Internet Applications : Port Scanner
Previous Topic (Printing)Next Topic (Browser) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder