Network Unreachable (Socket.net Exception)

by Frank Weiss » Sun, 07 Feb 2010 11:15:10 GMT


Sponsored Links
 Re your question about implementing a service that polls for updates, please
look at some of the sample code. For example, Romain Guy's Photostream demo
application has a background service that polls the Flikr API webservice for
updates and displays a notification in the notification bar. AFAIK whether
the access is by phone network or WiFi is functionally irrelevant.

--



Network Unreachable (Socket.net Exception)

by Frank Weiss » Mon, 08 Feb 2010 09:07:22 GMT


 Is the service completely crashing due to the exception or does the service
continue to get the exception subsequently? Are you perhaps wrongly assuming
that the phone is connected to the internet whenever you want it to be?

--


Sponsored Links


Network Unreachable (Socket.net Exception)

by Frank Weiss » Mon, 08 Feb 2010 10:50:10 GMT


 The network unreachable error is always a networking problem. Could be the
local network interfaces (wifi and phone) are turned off or temporarily
disabled, a bad network mask setting, or some router is unable to route an
IP address. It may also be an ipv6 config error. It may be occuring while
trying to resolve DNS (DNS server is unreachable). I have some suggestions:

1) Describe the network environment: emulator or device (which device) WiFi
on or off, wireless network carrier, local network configuration, including
firewalls (if using emulator or WiFi).
2) Test the application in a different network environment (home, office,
friend's house, cafe).
3) Add code that when the exception occurs, tries to access the network by
some other means besides HttpUrlConnection.
4) As 3), but try using a different Android application that accesses the
internet.
5) Try using an IP address instead of hostname.
6) I forgot to add, once the error occurs, how do you get the service to
connect again?

--



Other Threads

1. Fail to read file descriptor. Is this a bug or miss use?

I faced IOException when I tried to read file descriptor. Here is a
snippet.
----
    desc = getContentResolver().openFileDescriptor(uri, "r");
    descriptor = desc.getFileDescriptor();
    BufferedInputStream input = new BufferedInputStream(new
FileInputStream(descriptor));

    while ((len = is.read(fileBuffer)) != -1) {
    // do something like writing data to output stream.
    }
----

If I just read the file descriptor, it is fine. But, when I use the
data then I got an IOExcetion at FileInputStream#openCheck()

I solved this problem by using "getContentResolver().openInputStream
(uri)" instead of FileDescriptor.
But, I didn't understand the reason why I got an error. Does anyone
have idea on that?

Sung Ahn Kim.

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

2. how to parse and analyze the call stack of native code? any tools?

you can't find the line,but you can find fuction.

detail talk :
msn kernel_se...@163.com
qq 466919895


2009/4/19 Freepine <freep...@gmail.com>




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

3. view an image on android

4. this site in not available android plug in for Eclipse

5. Help with SimpleCursorAdaptor

6. Android SDK 1.5 Linux Permission Troubl

7. how to make ImageView to zoom and scroll