Solved

Winsock Control

Posted on 1998-11-26
3
208 Views
Last Modified: 2013-11-13
I need to know if there is another way to wait for a conection when I try to establish a Remote Conection. Right Now I'm Using this Tiny Do While

for Example

winsock1.conect Server(x.x.x.x) Port(NNNN)

Do while .state <> sckconnected
   DoEvents
Loop

I don't like this manner because my CPU reach 100% percent of utilization when the Code Reach the Do while.

Any help will be apreciated
ATT Joel
0
Comment
Question by:jcancel
  • 2
3 Comments
 

Accepted Solution

by:
ljaques earned 200 total points
ID: 1447056
When using the Winsock control there is a special event that occurs called : "Connect" that gets triggered when a connection has been established. So either select this event from the drop down box of the methods box (for the winsock control) or make a new procedure named: Private sub Winsock1_Connect()

Of course, by using this procedure it does not give you the ability to display the other states that the socket may be in just before connecting ie. "Resolving Host", "Wait For Response", etc.. To do this you would have to make a small while loop and continuously check the winsock1.state function.
0
 

Author Comment

by:jcancel
ID: 1447057
Adjusted points to 200
0
 

Author Comment

by:jcancel
ID: 1447058
ThanK you very Much
att Joel Cancel
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now