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]