request_Response stops responding in loop

rbw152

Member
Licensed User
Longtime User
Hi

I'm looping through a Datareader recordset from an SQLite database onboard a handheld Windows barcode scanner, then sending the data asynchronously to a web service, waiting for the response and writing it to the SQLite database.

This works fine... occasionally. Sometimes I can send a 150 records without a problem and then it sends 50 and stops. I have determined that the response_Stream event just stops firing and I have no idea why.

Here's the code in the loop:
QString = "?dbn=" & CurrentDB & "&kf=" & KeyField & "&aid=" & kfVal & "&un=" & UserName & FldValues
ULURL = URL & "/RTSQLsaveassetdetails.php" & QString
'Send the data
AsyncAction = "UploadAsset"
'lblLastScan.text="SENDING... " & kfVal
DoEvents
request.New1(ULURL)
Request.TimeOut = ConnectionTimeout*1000
response.New1
request.GetAsyncResponse

Here's the code for request_Response:

Case "UploadAsset"
If request.ResponseCode = 200 Then '200 is the code of successful connections.
response.Value = request.AsyncResponse
response.GetAsyncString
Else
lblLastScan.text="No connection"
DoEvents
response.Close
tmrUpload.Enabled = True
End If

And then response_Stream:

Case "UploadAsset"
'Return the value of LastUpdate on web db and save it to the local record
ret = response.AsyncString
response.Close
SaveLastUpdate(AIDUpload,ret)
lblLastScan.text="SENT: " & AIDUpload & " - " & ret
DoEvents
UpdateQueue
If QueueSize=0 Then
tmrUpload.Enabled = True
Else
'UpdateQueue
SendNextRecord
End If

And as I said, after a while response_Stream just stops responding.

It's driving me nuts I have to admit. Any ideas? Thanksssss!
 
Top