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



Subscribe to Tutorials

Related Tutorials

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

Java program using Method Overriding

Archived Comments

1. why treeSet always disply ascending order?
View Tutorial          By: swati at 2013-07-18 04:57:37

2. where is the main class dear.................
View Tutorial          By: akhand at 2011-03-01 23:58:05

3. The best explanation....Thanq :)
View Tutorial          By: Gautham at 2012-01-29 05:05:48

4. very good example...........
View Tutorial          By: debojit dey at 2010-07-20 15:48:38

5. Great ! done a gud job
View Tutorial          By: Manju at 2012-11-02 06:43:58

6. code givr an error when sending the Email:

View Tutorial          By: Ravi Shanker Yadav at 2013-05-08 12:36:59

7. hey,m i suspend the process before start to execut
View Tutorial          By: koustubh nakate at 2010-04-01 22:16:16

8. Where should I put the xml file ??????????
View Tutorial          By: Marya at 2014-03-21 16:01:13

9. i get exception NoSuchPortException. i tried on di
View Tutorial          By: harryjoy at 2009-11-22 05:52:48

10. Actually, 120º *is* 2.0943951023931953 radian
View Tutorial          By: Stephen Blythe at 2012-04-02 03:39:03