Results 1 to 4 of 4

Thread: Need confirm on Winsock GetData behaviour *resolved

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    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.

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    *bump

  3. #3
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803
    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:
    1. If Winsock1.State = sckConnected Then
    2.      Winsock1.GetData myData, vbString
    3. 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:
    1. If Winsock1.State = sckConnected Then
    2.      On Error GoTo WinsockGetDataError
    3.      Winsock1.GetData myData, vbString
    4.      On Error GoTo 0 ' or the previous error label thing...
    5. 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)

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    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
  •  



Click Here to Expand Forum to Full Width