Solved

Winsock Control

Posted on 1998-11-26
3
209 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Reading the Contents of a Directory In Access VBA 5 58
delphi parse string to params 3 97
MsgBox 2 47
VB6 ListBox Question 4 32
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The viewer will learn how to implement Singleton Design Pattern in Java.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

912 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

16 Experts available now in Live!

Get 1:1 Help Now