Java HTTP Port Find pingServer(String host, Integer port)

Here you can find the source of pingServer(String host, Integer port)

Description

ping Server

License

Open Source License

Declaration

private static Boolean pingServer(String host, Integer port) 

Method Source Code


//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;
        }
    }
}

Related

  1. parse(String specs, int defaultPort)
  2. parseCommaDelimitedHosts2(String hosts, int port_range)
  3. parseHostPort(String s)
  4. parsePort(String s)
  5. ping(String domain, int port)
  6. randomAvailablePort()
  7. randomFreePort()
  8. randomFreePort()
  9. randomFreePort()