String sText = "";
try {
/* prepare IP address */
String ipAddress = "10.26.1.3";
InetAddress inet = InetAddress.getByName( ipAddress );
/* check ping (timeout=1000 ms) */
if ( inet.isReachable( 1000 ) )
sText = "Client is reachable";
else
sText = "Client isn`t reachable";
} catch( UnknownHostException ex ) {
Logger.getLogger( FXMLMainController.class.getName() ).log( Level.SEVERE, null, ex );
} catch( IOException ex ) {
Logger.getLogger( FXMLMainController.class.getName() ).log( Level.SEVERE, null, ex );
}
memo.setText( sText );
Microsoft AX 2012, X++, C#, SQL server, SSRS, Java, JavaFX, Oracle, PL/SQL, Delphi - codes examples, step-by-step tutorials, experiences.
Friday, March 2, 2018
JAVA - How check if client is reachable - ping to client
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment