Here is the result of my program :

C:\>javac MajidPortScanner4.java

C:\>java MajidPortScanner4
Test for ip 155.108.117.068 .......................................
current port scanning is :80
HTTP/1.1 400 Bad Request
Server: Microsoft-IIS/5.0
Date: Wed, 06 Feb 2002 14:39:50 GMT
Content-Type: text/html
Content-Length: 87

<html><head><title>Error</title></head><body>The parameter is incorrect. </body>
</html>
A server is listening on port 80 of dev-gisg.statestr.com
current port scanning is :8080
The remote host dev-gisg.statestr.com is not listening on this port

Test for ip 155.108.117.012 ..........................................
current port scanning is :80
HTTP/1.1 400 Bad Request
Server: Microsoft-IIS/5.0
Date: Wed, 06 Feb 2002 14:39:51 GMT
Content-Type: text/html
Content-Length: 87

<html><head><title>Error</title></head><body>The parameter is incorrect. </body>
</html>
A server is listening on port 80 of MIL2WWDS40
current port scanning is :8080
The remote host MIL2WWDS40 is not listening on this port

Test for ip 155.108.117.82 ................................................
current port scanning is :80
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>400 Bad Request</TITLE>
</HEAD><BODY>
<H1>Bad Request</H1>
Your browser sent a request that this server could not understand.<P>
Invalid URI in request GET HTTP/1.0
<P>
<HR>
<ADDRESS>Apache/1.3.22 Server at mil2wwds011 Port 80</ADDRESS>
</BODY></HTML>
A server is listening on port 80 of MIL2WWDS011
current port scanning is :8080
The remote host MIL2WWDS011 is not listening on this port

Test for ip 155.108.117.064 .................................................
current port scanning is :80
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>400 Bad Request</TITLE>
</HEAD><BODY>
<H1>Bad Request</H1>
Your browser sent a request that this server could not understand.<P>
Invalid URI in request GET HTTP/1.0
<P>
<HR>
<ADDRESS>Apache/1.3.22 Server at MIL2WWDS13.statestr.com Port 80</ADDRESS>
</BODY></HTML>
A server is listening on port 80 of MIL2WWDS13.statestr.com
current port scanning is :8080
HTTP/1.0 404 Not Found
Content-Type: text/html
Content-Length: 163
Servlet-Engine: Tomcat Web Server/3.2.3 (JSP 1.1; Servlet 2.2; Java 1.3.0_02; Wi
ndows 2000 5.0 x86; java.vendor=Sun Microsystems Inc.)

<head><title>Not Found (404)</title></head>
<body><h1>Not Found (404)</h1>
<b>Original request:</b> HTTP/1.0


<b>Not found request:</b> HTTP/1.0</body>
A server is listening on port 8080 of MIL2WWDS13.statestr.com
C:\>

AND here is where I disply this data to the console and in the same time to a file :



...........String fname = "zfile.txt";try {......FileWriter writer = new FileWriter(fname); while ((theLine = br.readLine()) != null) { System.out.println(theLine); writer.write(theLine, 0, theLine.length()); //writer.close(); } writer.close(); } catch (MalformedURLException e) { System.out.println( " not a valid URL"); } catch (IOException e) { System.out.println(e); }.........


BUT when I checked the text file zfile.txt I only found this :

HTTP/1.0 404 Not FoundContent-Type: text/htmlContent-Length: 163Servlet-Engine: Tomcat Web Server/3.2.3 (JSP 1.1; Servlet 2.2; Java 1.3.0_02; Windows 2000 5.0 x86; java.vendor=Sun Microsystems Inc.)<head><title>Not Found (404)</title></head><body><h1>Not Found (404)</h1><b>Original request:</b> HTTP/1.0

<b>Not found request:</b> HTTP/1.0</body>

Where is the other data ??