Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17



Posted on 1999-07-22
Medium Priority
Last Modified: 2013-11-13
I had start recently to study winsck VB programming and it came to me about doing a simple port scanner. I´ve tried to do a simple class D scanner but I just can´t figure why it doens´t find any open port! Every port he finds its closed! I´ve tried with a port scanner I have and it finds an open port but when I try with this the port is closed!!
I just can´t figure out why this doesn´t work!
...Another thing... How can I stop the scanner?
Here's the code:

For forth = classD1.Text To classD2.Text
tcpsock.Protocol = sckTCPProtocol
tcpsock.RemoteHost = classA1.Text & "." & classB1.Text & "." & classC1.Text & "." & forth
tcpsock.RemotePort = 21
If tcpsock.State <> sckConnected Then
log.Text = tcpsock.RemoteHost & "  Closed !!"
log.Text = tcpsock.RemoteHost & "  Open !!"
End If
Call Pause(x)  'Pause for x seconds (The program is going to get the x from a text box)
Next forth
Question by:alexbeaty
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

VBGuru earned 200 total points
ID: 1526696
use it like this
Private Sub Form_Click()

End Sub

Private Sub Winsock1_Connect()
If Winsock1.State <> sckConnected Then
MsgBox "  Closed !!"
MsgBox "  Open !!"
End If
End Sub


Author Comment

ID: 1526697
It works fine!!

But why don´t mine works?

Thx anyway

Expert Comment

ID: 1526698
Because that time when you test for the state of the winsock it is not connected to the server.
Connect event Occurs after a connection is established to the server.


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
If you haven’t already, I encourage you to read the first article ( in my series to gain a basic foundation of R and R Studio.  You will also find the …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question