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. Hello guys, the code above is the full complete co
View Tutorial          By: Dalma at 2012-10-03 02:50:33

2. Very useful and simple.
Thanks.

View Tutorial          By: harsh at 2014-11-06 10:01:22

3. really a nice tutorial for beginners...Thanks a lo
View Tutorial          By: ps at 2013-02-26 09:28:53

4. Precise information in the article, however it wou
View Tutorial          By: Ketan at 2009-06-23 05:07:39

5. can any body help to get the code for receiving SM
View Tutorial          By: ash at 2008-05-15 01:07:19

6. You just save ma arse, had a SQLite database, and
View Tutorial          By: codeRealm at 2011-11-13 12:58:05

7. Sir if i wnna to take the input from user then it
View Tutorial          By: Vivek at 2011-05-14 05:56:30

8. The code is working for me as i have included &quo
View Tutorial          By: MOHAN at 2011-06-29 04:08:04

9. Thanks, this is exactly i am looking for. I need t
View Tutorial          By: Ankita at 2009-11-15 19:41:16

10. I have a squid proxy installed as forward proxy an
View Tutorial          By: ruffy at 2012-12-20 12:34:15