Here you can find the source of pingServer(String host, Integer port)
private static Boolean pingServer(String host, Integer port)
//package com.java2s; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.Socket; public class Main { private static Boolean pingServer(String host, Integer port) { String timeStamp = ""; Socket socket = null;//from w ww. j a v a 2s . c om BufferedReader br = null; try { socket = new Socket(host, port); br = new BufferedReader(new InputStreamReader(socket.getInputStream())); timeStamp = br.readLine(); socket.close(); return true; } catch (Exception e) { return false; } } }