|
-
Feb 22nd, 2003, 06:45 AM
#1
Need confirm on Winsock GetData behaviour *resolved
Once .GetData strSample fails, is it pointless to do Resume and try again since the receive buffer is cleared (unlike .PeekData)?
Or does the stream still reside in the buffer after the fail (assuming there's data in the buffer) so a Resume can handle the error?
I'm trying to decide what error handling is needed for .GetData, if its necessary at all. Thanks.
Last edited by leinad31; Feb 23rd, 2003 at 06:01 AM.
-
Feb 22nd, 2003, 10:40 AM
#2
-
Feb 23rd, 2003, 02:00 AM
#3
I use Winsock a lot, and I never got errors at the line with Winsock.GetData (when connected that is)
So when you get the data, make sure your connected
VB Code:
If Winsock1.State = sckConnected Then
Winsock1.GetData myData, vbString
End If
Sometimes it happens that the event DataArrival is fired and the socket is not connected, usually it happens when the Winsock.Close get's called after the DataArrival and before the GetData... it rarely happens...
Also you could do and error trap just for that line, something like
VB Code:
If Winsock1.State = sckConnected Then
On Error GoTo WinsockGetDataError
Winsock1.GetData myData, vbString
On Error GoTo 0 ' or the previous error label thing...
End If
And about this: "Once .GetData strSample fails, is it pointless to do Resume"
Since I rarely get an error at GetData line, I don't bother to write code for the resume (I usually write code to stop everything when that happens)
-
Feb 23rd, 2003, 05:55 AM
#4
Thanks CVMichael. I knew I could count on you to reply.
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
|