Hello,
I need to determine, what web server (IIS, Apache, Jetty) is running on port 80 in Java.
Are there any solutions to get the informations via port 80?
Thanx and reguards
Stefan
Hello,
I need to determine, what web server (IIS, Apache, Jetty) is running on port 80 in Java.
Are there any solutions to get the informations via port 80?
Thanx and reguards
Stefan
You can ask it - issue a HEAD request, e.g. open a TCP connection on port 80 and just send
HEAD / HTTP/1.0
or
HEAD / HTTP/1.1
Host: the.server.hostname.com
and the reply should contain a Server line
Server: Microsoft-IIS/5.1
amongst other things.
If you want to ask the OS which process, though, I don't know a Java-portable way. Command line you would run netstat -ano
or (-anp
on linux I think) which will give you the process number listening on port 80, and then you can look that up to find out exactly which server has the port.
Look at the Server:
HTTP header. It will usually contain something like this:
Server: Apache/2.2.10 (SpaceNet) PHP/5.2.6
Of course, the server can send whatever it likes, or not send anything at all.