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. Very simple, clear visualized and meaning
View Tutorial          By: HIM at 2011-07-21 21:43:58

2. thank you for your excellent explaination..! :)
View Tutorial          By: marios at 2012-05-16 16:17:31

3. I want to get SCJP!
View Tutorial          By: Johny at 2009-08-24 22:48:56

4. This article helped me a lot to learn struts 2 and
View Tutorial          By: Shiv Prakash at 2012-12-07 07:37:35

5. At my phone number, it showing

5 re

View Tutorial          By: Zafar Iqbal at 2013-04-02 19:48:32

6. nice code.....
View Tutorial          By: ♥♠darryl♠♥ at 2009-02-19 06:24:12

7. i want the database connectivity for telephone bil
View Tutorial          By: rohan at 2015-04-05 05:01:46

8. Hi,
All the information here was very much

View Tutorial          By: Shaiju at 2008-05-30 00:42:12

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

10. i tried your code but i got an error on this line<
View Tutorial          By: edward at 2011-12-09 11:32:30