I am using the winsock control in vb6 to check the availability of a web service. I do a post request, get the response and parse the response header to check the response code.
The response arrives in multiple packets.
' this event occurs when data is arriving via winsock
Private Sub wsTCP_DataArrival(ByVal bytesTotal As Long)
Dim strResponse As String
wsTCP.GetData strResponse, vbString, bytesTotal
strResponse = FormatLineEndings(strResponse)
' we append this to the response box becuase data arrives
' in multiple packets
response = response & strResponse
End Sub
My problem is that I need to wait until I check the response code to continue execution.
Is there any way to do this without using a timer?
Thanks, Alex
decided to use the timer after all.
response = response & strResponse
is not great for performance because it reallocates strings like crazy. If performance and/or large responses are expected the a better approach is to allocate a large buffer that doesn't need to get resized on every DataArrival and insert the data frames into it at the correct offset. – tcarvin