Comment on Tutorial - Simple Port Scanner application using Java By Syed M Hussain



Comment Added by : Asad

Comment Added at : 2014-02-13 05:55:26

Comment on Tutorial : Simple Port Scanner application using Java By Syed M Hussain
Try this

import java.net.*;

public class PortScanner

{

public static void main(String args[])
{
int startPortRange=0;
int stopPortRange=0;

startPortRange = Integer.parseInt(args[0]);
stopPortRange = Integer.parseInt(args[1]);



for(int i=startPortRange; i <=stopPortRange; i++)
{
try
{
Socket ServerSok = new Socket("127.0.0.1",i);

System.out.println("Port in use: " + i );

ServerSok.close();
}
catch (Exception e)
{
}
System.out.println("Port not in use: " + i );
}
}
}


View Tutorial



Related Tutorials

Java program to get location meta data from an image

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Archived Comments

1. Okay, this article cleared my two doubts i.e. Use
View Tutorial          By: Shrikrishna Meena at 2010-09-26 12:38:04

2. Thanks, cleared the situation!!
View Tutorial          By: alex at 2010-03-23 16:16:49

3. @Prab, no its 7 since it starts the counting at 0
View Tutorial          By: Shadowfaux at 2009-11-21 15:22:49

4. Cool! Downloading the whole file with the HttpCon
View Tutorial          By: Luddite at 2010-06-26 12:26:26

5. i am converting from Visualbasic 6 to java web app
View Tutorial          By: Qui at 2010-01-05 07:26:07

6. Thanks...it was very helpful :)
View Tutorial          By: Swathi at 2012-01-25 06:49:46

7. great work..keep it up.
View Tutorial          By: faizaan at 2011-04-29 12:23:39

8. i like google
View Tutorial          By: parikh dhruti at 2013-02-12 06:43:19

9. Perfectly working, and able to connect database.
View Tutorial          By: satyajit at 2012-06-01 20:16:53

10. you have extended class Abc within class Abc

View Tutorial          By: SUNIL SHAH at 2012-05-25 06:17:23