Gordon Beaton wrote:
Of course there are extremly few clues in your post to give the
slightest indication of what you might be doing wrong. Are you asking
us to guess why it doesn't work?
Okay Gordon, to both respond back to your apparent need to know some
details about this exception, AND to maybe "re-activate" this particular
thread which, I noticed, hasn't seen much activity on since early this
AM, here is a "PortScanner.java" file which has given me the exception
when i try to execute it, i.e., use the java interpreter on it, not
necessarily when I try to compile it, which it does okay.
"import java.io.*;
import java.net.*;
/**
* Port Scanner
*
* Scans for servers listening on a range of ports.
*/
public class PortScanner
{
final static int LOW_RANGE = 0; //scan reserved ports
final static int HIGH_RANGE = 1023;
public static void main(String[] args)
{
Socket connect=null;
String host = "localhost"; //defaults to local host
if (args.length > 0)
{
host = args[0]; //sets host to command-line parameter
}
for (int iCount = LOW_RANGE; iCount < HIGH_RANGE; iCount++)
{
System.out.print("Checking port " + iCount + "...");
try
{
connect = new Socket(host, iCount);
System.out.println("Server responding on port " +
iCount + " of " + host);
}
catch (UnknownHostException e)
{
System.err.println("Host is invalid.");
break;
}
catch (IOException e)
{
System.out.println("No server found");
}
finally
{
try
{
connect.close(); //close socket connection
}
catch (Exception e) {}
}
}
}
}"