Results 1 to 2 of 2

Thread: Java PING

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User BeTaTesTeR's Avatar
    Join Date: Nov:2006
    Location:
    Posts: 6,693

    Java PING

    ,

    Java web . , isReachable , 3 . , . . 3- , . abv.bg, google.bg/com, facebook.com, btv.bg , . , dir.bg hardwarebg.com , 3 ms. , , , , .
    . , , .
    !


    Code:
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.net.*;
    
    
    public class pingaddress  {
    
        /**
         * @param args
         */
        public static void main(String[] args) throws  IOException {
            try {
    
               
                
                      String ipAddress = "www.dir.bg";
                    InetAddress inet = InetAddress.getByName(ipAddress);
    
                    System.out.println("Sending Ping Request to " + ipAddress);
                    System.out.println("Name of the address " + InetAddress.getByName(ipAddress));
                    long tm = System.currentTimeMillis();
                    System.out.println(inet.isReachable(3000) ? "Host is reachable" : "Host is NOT reachable");
                    tm = System.currentTimeMillis()-tm;
                    System.out.println("Ping was for: " + tm +"."+ "ms") ;
    
    
            } catch (Exception e){
    
                e.printStackTrace() ;
    
            }
        }    
    }
    !

  2. #2
    Registered abUser ike's Avatar
    Join Date: Jul:2004
    Location: sofi
    Posts: 4,965
    5 .... google, inet.isReachable root/administrator ICMP ping, TCP 7. , , timeout- . , firewall , .
    tl;dr
    TCP 80.
    Have no fear ike iz here.
    CPU Cx486DLC@40MHz, RAM 4MB, VGA Trident 512KB, HDD Conner 160MB, Monitor 14" Color

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |