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. This is very good Article. On high level I am anba
View Tutorial          By: Sandeep at 2010-08-27 00:40:22

2. can I ask question? how to make a complete program
View Tutorial          By: manuel at 2012-08-13 10:06:24

3. Thank you for a great explanation now I'm in the l
View Tutorial          By: C++Noob at 2011-12-22 04:43:31

4. Your article is very useful.

But I

View Tutorial          By: Me at 2013-04-07 10:20:00

5. i nice programs tks
View Tutorial          By: jai at 2011-05-09 14:09:38

6. Hi,
I've tried this but got a problem. Firs

View Tutorial          By: Hendrik Jabs at 2009-12-10 02:46:13

7. good explanation,
Thanks

View Tutorial          By: venkatesh at 2012-01-04 08:43:48

8. how about if you attach microsoft word documents?p
View Tutorial          By: gian at 2012-01-06 03:11:44

9. hi, srinivas ... i too was having the same problem
View Tutorial          By: Ashish at 2009-04-07 06:57:31

10. Very helpful and easily understandable!
View Tutorial          By: Teerna at 2014-11-12 23:55:49