Web ping : HTTP Server « Network « Java Tutorial






import java.net.InetAddress;
import java.net.Socket;

public class Main {
  public static void main(String[] args) throws Exception {
    InetAddress addr;
    Socket sock = new Socket(args[0], 80);
    addr = sock.getInetAddress();
    System.out.println("Connected to " + addr);
    sock.close();
  }
}








19.25.HTTP Server
19.25.1.Lightweight HTTP Server
19.25.2.Grabbing a page using socket
19.25.3.POSTing data to an HTTP server
19.25.4.Sending a POST Request Using a Socket
19.25.5.Web ping