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. I did all steps, but it only shows the first pictu
View Tutorial          By: behzad at 2012-07-15 16:32:41

2. tnx man that was short and well explained...
View Tutorial          By: jsf noob at 2012-02-02 13:24:12

3. for user input use this method....
1. impor

View Tutorial          By: susmit at 2011-03-02 09:09:46

4. Hi, I am getting following exception while running
View Tutorial          By: Vasundhra at 2008-06-24 07:04:42

5. Thank you! Nice article.
View Tutorial          By: Koja at 2013-04-23 20:58:05

6. very informative
View Tutorial          By: santhosh reddy WILLY at 2012-07-06 21:33:39

7. Hello all,
Please help me out. I want to cr

View Tutorial          By: Richa Bhatia at 2009-12-07 22:55:54

8. Plz send code of sending sms from java code...

View Tutorial          By: Shekh at 2014-11-27 14:18:25

9. that is fifo rigth? how about lifo?
View Tutorial          By: galz at 2015-02-18 03:03:31

10. i need save,delete,update use arrayList.
th

View Tutorial          By: kyaw at 2010-04-07 01:55:02