Couldn't open socket error from URLConnection getInputStream ??

by ole! » Thu, 22 May 2008 05:20:20 GMT


Sponsored Links
 I get "Couldn't open socket" error from my Android app after it runs
for a few hours.

A thread is in a while loop doing URL.openConnection.... after many of
these (about 1000), I get the error. Has anybody encountered this and/
or have a fix for it? Any help would be appreciated.

The snippet of code in the while loop body is:
                        URL myURL = new URL(urlString);
                        URLConnection ucon = myURL.openConnection();
                        inStream = ucon.getInputStream();
                        input = new Scanner(inStream);
.....
                        inStream.close();



log file below:

D/dalvikvm( 1224): Exception Ljava/lang/RuntimeException; from
HttpConnectionManager.java:139 not caught locally
W/dalvikvm( 1224): threadid=17: thread exiting with uncaught exception
(group=0x4000fdf8)
E/AndroidRuntime( 1224): Uncaught handler: thread httpThread exiting
due to uncaught exception
E/AndroidRuntime( 1224): java.lang.RuntimeException: Couldn't open
socket
E/AndroidRuntime( 1224):        at
org.apache.harmony.luni.platform.OSNetworkSystem.createSocketImpl(Native
Method)
E/AndroidRuntime( 1224):        at
org.apache.harmony.luni.platform.OSNetworkSystem.createSocket(OSNetworkSystem.java:
79)
E/AndroidRuntime( 1224):        at
org.apache.harmony.luni.net.PlainSocketImpl2.create(PlainSocketImpl2.java:
59)
E/AndroidRuntime( 1224):        at
java.net.Socket.checkClosedAndCreate(Socket.java:763)
E/AndroidRuntime( 1224):        at java.net.Socket.connect(Socket.java:910)
E/AndroidRuntime( 1224):        at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:
61)
E/AndroidRuntime( 1224):        at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager
$ConnectionPool.getHttpConnection(HttpConnectionManager.java:145)
E/AndroidRuntime( 1224):        at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager.getConnection(HttpConnectionManager.java:
67)
E/AndroidRuntime( 1224):        at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getHTTPConnection(HttpURLConnection.java:
788)
E/AndroidRuntime( 1224):        at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:
774)
E/AndroidRuntime( 1224):        at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:
1018)


--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. YouTube + Buzz = Live Geo-Based Video Streams [What If?]

Kalo memang beneran bisa nih..
Terobosan banget...
Mantaaaapppp

 http://www.***.com/ 

sent from my {*filter*} nexus

-- 
"Indonesian Android Community [id-android]" 

Join:  http://www.***.com/ 
Moderator: id.andr...@gmail.com
Unsubscribe: id-android+unsubscr...@googlegroups.com
id android Developer:  http://www.***.com/ 
id android on FB:  http://www.***.com/ 

2. File download-an dari market disimpen dimana y

as subject

rekan2 androiders, klo abis download dari google market file .apk nya ditaro
dimana ya?
klo slideme kan masuk ke /sdcard/slideme/downloads tuh

tenx

-- 
"Indonesian Android Community [id-android]" 

3. Reading back one of my own parcelables?

4. to get/generate nonce. error in random, getBytes Options

5. Google Checkout Order System Not Updating

6. Why can't I post

7. Creating DEMO and FULL versions