|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: Aug 2004
Messaggi: 1728
|
[Java] Effettuare un ping verso un dato indirizzo IP
Ciao, conoscete un modo in Java per pingare un dato indirizzo ip con una data porta? Mi spiego meglio...in sostanza devo effettuare un semplice ping verso IP:PORT, in caso positivo effettuare una certa azione, in caso negativo un'altra. Ho trovato questi esempi che però non mi aiutano visto che non c'è la porta
try { InetAddress inet = InetAddress.getByName("172.16.2.0"); boolean status = inet.isReachable(5000); //Timeout = 5000 milli seconds } oppure if(InetAddress.getByAddress("173.194.35.133".getBytes()).isReachable(1000)==true) { //Boolean variable named network network=true; //Ping works } else { network=false; //Ping doesnt work } qualche idea? Grazie ![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Iscritto dal: Mar 2007
Città: Milano Beach
Messaggi: 1696
|
"You can't ping ports, as Ping is using ICMP which doesn't have the concept of ports."
![]() http://serverfault.com/questions/309...-specific-port usa nmap o telnet.
__________________
~ Cthulhu: MacBookPro 13.3" ~ Azathoth: D510MO |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 15:39.