Network Test Utility

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Network Test Utility

Postby Flixi » Wed Nov 26, 2008 3:21 pm

I'm currently working on a small network test utility. For a start I like the program to be able to test the network latency (ping) for both 3G and WiFi when it's available.

Currently I got this method "ping", but I loose all my packets. It's not due to the method above, since the same thing is happening when I type: ping -c 4 d.dk in the terminal. I have tried pinging different hosts with the same result.

Does any one have an idea what couses this problem. I can tell that I'm currently using Meteor as carrier in Ireland.

Code: Select all
$ ping d.dk
PING d.dk (130.228.0.11): 56(84) bytes of data

--- d.dk ping statistics ---
4 packets transmitted, 0 packets received, 100% packet loss, time 3016ms

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.  public void ping(String host){
  3.  
  4.                 TextView ping = (TextView)findViewById(R.id.ping);
  5.  
  6.         try {
  7.  
  8.             String line = "";
  9.  
  10.             final Runtime rt = Runtime.getRuntime();
  11.  
  12.             final Process p = rt.exec("ping -c 4 " + host);
  13.  
  14.             final BufferedReader BR = new BufferedReader(new InputStreamReader(p.getInputStream()));
  15.  
  16.            
  17.  
  18.             ping.append("Pinging host: " + host + "\n");
  19.  
  20.            
  21.  
  22.             while ((line = BR.readLine()) != null ) {
  23.  
  24.                        
  25.  
  26.                         ping.append(line + "\n");
  27.  
  28.                         Log.v(TAG, "Line: " + line);
  29.  
  30.             }
  31.  
  32.             BR.close();
  33.  
  34.             } catch (IOException e) {
  35.  
  36.                 e.printStackTrace();
  37.  
  38.                 Log.v(TAG, "PING - IOException: " + e);
  39.  
  40.            }      
  41.  
  42.     }
  43.  
  44.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4
Flixi
Freshman
Freshman
 
Posts: 2
Joined: Sun Nov 16, 2008 2:49 am
Location: Dublin, Ireland

Top

Postby tonyant » Fri Dec 26, 2008 8:22 am

I meet the something question as your.
At last, I use InetAddress.getByName(server).isReachable(timeOut) replace. However it only retrun true or false.
tonyant
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Dec 26, 2008 8:15 am

Ping

Postby milkround » Sun Dec 20, 2009 12:44 am

Did you ever get an answer to this problem??

I too want to Ping my local network to get the (local) IP address of one of my PC's via the Host name ie.

Ping MYPCNAME

InetAddress[] loginIPs = InetAddress.getAllByName("steve-tosh");

generates a UnknownHostException

Has anyone got any suggestions??

Steve
milkround
Developer
Developer
 
Posts: 34
Joined: Sat May 02, 2009 2:29 pm
Location: UK & Malta

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 4 guests