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

x
?
Solved

winsck

Posted on 1999-07-22
3
Medium Priority
?
220 Views
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
tcpsock.Connect
If tcpsock.State <> sckConnected Then
log.Text = tcpsock.RemoteHost & "  Closed !!"
Else
log.Text = tcpsock.RemoteHost & "  Open !!"
End If
tcpsock.Close
Call Pause(x)  'Pause for x seconds (The program is going to get the x from a text box)
Next forth
0
Comment
Question by:alexbeaty
[X]
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
3 Comments
 
LVL 6

Accepted Solution

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

End Sub

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


0
 

Author Comment

by:alexbeaty
ID: 1526697
It works fine!!

But why don´t mine works?

Thx anyway
0
 
LVL 6

Expert Comment

by:VBGuru
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.

0

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 (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) 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