Hello,
I am using B4J to prototype an application that will eventually be moved to B4A. The application uses B4J's HttpUtils2 library. The program downloads OSM tiles. I used your Image Downloader as an example changing the downloader service to a class in B4J.
I get the following error upon executing, after about a 30 second timeout, of the hj.download(t) line.
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
This is the immediate area of code (I've also attached the project export)
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
This is just a prototype in B4J – I really don't need it to work in B4J. I am wondering what causes the error. I will be moving it to B4A. If I enter the URL (t) into a browser I receive the JPG tile back successfully.
Barry.
			
			I am using B4J to prototype an application that will eventually be moved to B4A. The application uses B4J's HttpUtils2 library. The program downloads OSM tiles. I used your Image Downloader as an example changing the downloader service to a class in B4J.
I get the following error upon executing, after about a 30 second timeout, of the hj.download(t) line.
			
				B4X:
			
		
		
		http://otile1.mqcdn.com/tiles/1.0.0/sat/14/4728/6019.jpg ' (<- log(t) output)
Nov 22, 2013 7:57:31 PM org.apache.http.impl.client.DefaultRequestDirector execute
INFO: I/O exception (java.net.SocketException) caught when processing request: Connection reset
Nov 22, 2013 7:57:31 PM org.apache.http.impl.client.DefaultRequestDirector execute
INFO: Retrying request
java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:152)
    at java.net.SocketInputStream.read(SocketInputStream.java:122)
    at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:130)
    at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:127)
    at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:233)
    at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:98)
    at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:210)
    at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:271)
    at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:227)
    at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:229)
    at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:292)
    at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:126)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:447)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:554)
    at anywheresoftware.b4a.http.HttpClientWrapper.executeWithTimeout(HttpClientWrapper.java:309)
    at anywheresoftware.b4a.http.HttpClientWrapper.access$0(HttpClientWrapper.java:307)
    at anywheresoftware.b4a.http.HttpClientWrapper$ExecuteHelper.run(HttpClientWrapper.java:208)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)This is the immediate area of code (I've also attached the project export)
			
				B4X:
			
		
		
		Public Sub Download ' check if svrs avail, create jobs
  Do While (True)
    If ((SvrCache.Size > 0) AND (TileCache.Size > 0)) Then
      Dim i As Int
      Dim s, t, u As String
      Dim tr As TileRec
   
      tr.Initialize
   
      i = SvrCache.Size - 1
      s = SvrCache.Get(i)
      SvrCache.RemoveAt(i)
   
      i = TileCache.Size - 1
      tr = TileCache.Get(i)
      TileCache.RemoveAt(i)
   
      t = s.Replace("*z", tr.zm).Replace("*x", tr.x).Replace("*y", tr.y)
      u = tr.zm & "_" & tr.x & "_" & tr.y
   
      Log(t)
      Dim hj As HttpJob
      hj.Initialize(u, Me)
      hj.Download(t)
      tr.svr = s
      ogTasks.Put(u, tr)
    Else
      Exit   
    End If
  Loop
End SubThis is just a prototype in B4J – I really don't need it to work in B4J. I am wondering what causes the error. I will be moving it to B4A. If I enter the URL (t) into a browser I receive the JPG tile back successfully.
Barry.
Attachments
			
				Last edited: 
			
		
	
								
								
									
	
		
			
		
	
								
							
							 
				 
 
		 
 
		 
			 
 
		 
 
		 
 
		 
 
		 
 
		