package nur.khasanah.main;
/**^
*
* @author DELL XPS L501
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
public class PortScanner {
public static void main(String[] args)
{
BufferedReader dataIn = new BufferedReader(new InputStreamReader(System.in));
String remote = "localhost";
int start = 0, end = 140;
do
{
try
{
Socket s = new Socket(remote, start);
//System.out.println("Port " + start + " of " + remote);
System.out.println("Port " + start + " of " + remote + " OPEN");
s.close();
} catch (IOException ex)
{
System.out.println("Port " + start + " of " + remote + " close");
}
start++;
} while (start <= end);
}
}