|
-
Aug 23rd, 2000, 08:29 AM
#1
Thread Starter
Fanatic Member
I am trying to use the Winsock Control in a class object.
My problem is trying to figure out the best way of detecting a response from the computer I am connecting to.
When I had a form using Winsock I waited on the DataArrival event.
Code:
Private Sub mobjWinsock_DataArrival(ByVal bytesTotal As Long)
'Check for response from the remote host
mobjWinsock.GetData mvarResponse
End Sub
Now that I am inside a class I can't place
Code:
Set mobjWinsock = New MSWinsockLib.Winsock
in the general section of the class so that the same object can be used throughout the class and then I would be able to watch for that event.
Sooooo....
I could place
Code:
mobjWinsock.GetData mvarResponse
in the same sub that I create the winsock control, but this needs me to another question.
If a computer takes say 30 seconds to respond back how to I wait for the response then? Just place
Code:
mobjWinsock.GetData mvarResponse
in a loop and say after 30 seconds or so in the loop error out if there is no response back? I don't know if I should keep issuing the GetData and what adverse affects it would cause.
Thanks for any help you can give.
[Edited by steve65 on 08-23-2000 at 09:39 AM]
-
Aug 23rd, 2000, 08:32 AM
#2
So Unbanned
Uhm,
you may want to use:
winsock1.getdata myvar, vbstring
Word to your mother,
-
Aug 23rd, 2000, 08:43 AM
#3
Thread Starter
Fanatic Member
I understand what command to use to get the response back. I am just not sure of the best way getting a response inside a class if the responding server is slow to answer.
Originally posted by DiGiTaIErRoR
Word to your mother,
Huh??
-
Aug 23rd, 2000, 10:34 AM
#4
Thread Starter
Fanatic Member
I was able to work this out. I did not now about the Class_Initialize sub.
Code:
Private Sub Class_Initialize()
Set mobjWinsock = New MSWinsockLib.Winsock
End Sub
Everything works great now.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|