guys and girls,

i am trying to test the availability of a service with a socket. the
code is quite simple
                try {
                        InetAddress address = InetAddress.getByName(dns);
                        s = new Socket();
                        try {
                                SocketAddress endpoint = new 
InetSocketAddress(address, port);
                                s.connect(endpoint, 1000);
                                s.close();

                                return true;
                        } catch (IOException e) {
                                return false;
                        }
                } catch (UnknownHostException e) {
                        return false;
                }

it works in the emulator and i thought everything was ok. but it does
not work on my device (ADP with 1.6.) actually it does work, but not
with 3G.

the socket.connect blocks when the device is in wifi mode, as
expected. but when on 3G it just continues, as if a connection has
been made.

(the tested case is port 80 on an amazon ec2 instance.)

can anyone either tell me why this happens so i can fix. or perhaps
there is an alternative to testing service connections for
availability.

thanks,
jurg.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to