Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java
Expertise: All
Jul 23, 1999

Determine What Web Server Is Installed on a Remote Machine

Using Java, you can easily find out what Web server is installed on a remote machine. Just open a URLConnection to the remote host and parse the header for the "Server" entity, which will give the name of the Web server.

 
//pass the site address as command line argument
//eg:- java http://www.javasoft.com
import java.io.*;
import java.net.*;
public class findServer
{
    public static void main(String a[])
    {
        try
        {
            URL u=new URL(a[0]);
            System.out.println("Web server of site"+a[0]+"is 
-"+u.openConnection().getHeaderField("Server"));
        }
        catch(Exception e)
        {
            System.out.println(e);
        }
    }
}
Udayananthan Prabhuram
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap