HTTP Library

bish0p

Member
Licensed User
Longtime User
I don't know if I am doing something wrong with the HTTP Library but this code


B4X:
Sub Getfound()


   wwwreq2.New1("http://www.geocaching.com/my/")
   wwwreq2.TimeOut=120000
   wwwreq2.AddHeader("Cookie",GC_Session_ID&" "&GC_user_id)
   Msgbox(wwwreq2.Headers)
   wwwres2.Value = wwwreq2.GetResponse

   tmp=wwwres2.GetString
   Textbox1.Text=tmp
   regex.New1("Caches Found: [0-9]+")
   match.Value=regex.Match(tmp)
   
   Return SubString(match.String,13,StrLength(match.String))
End Sub

Works like a charm on the Desktop hangs on the "wwwres2.Value = wwwreq2.GetResponse" on my device

After I have logged onto the site I ask it to fetch the number of caches I have found. This is done my calling Geocaching - Login with the ASP.NET_SessionID set to the correct Cookie,

It seems that once I have connected to 2 URLS it the device hangs on the third call to GetResponse. Yes I have the current version of the HTTP Lib.

Any Ideas.

James
 
Last edited:

Mr_Gee

Active Member
Licensed User
Longtime User
Maybe you need to close the webresponse before starting a new one?
(just thinking out loud here)

-=edit=-
seems to a correct assumption, form the help file :
-----
Sub GetText (URL)
Response.New1
Request.New1(URL)
Response.Value = Request.GetResponse 'This line calls the server and gets the response.
string = Response.GetString 'Get the Response string.
Response.Close
return string
End Sub
 
Last edited:

agraham

Expert
Licensed User
Longtime User
Maybe you need to close the webresponse before starting a new one?
Well spotted Mr_Gee :sign0188:. From the book "Network Programming for the .NET Framework".
should be closed ... if not called the application will leak resources and run out of allowed connections.
So even if not the root problem here definitely something that needs doing in any case.
 
Top