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



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. To "need help":

String st

View Tutorial          By: alex at 2010-05-13 09:57:25

2. hello

my problem is how to intrega

View Tutorial          By: mihir patel at 2013-11-28 18:10:04

3. it shows error
java.lang.NoClassDefFoundEr

View Tutorial          By: vamsi at 2010-05-14 23:09:03

4. i know this example this is in mg.hill but i want
View Tutorial          By: srikanta at 2009-11-18 00:06:57

5. this is the one of the best site to search java pr
View Tutorial          By: gautam gorai at 2009-01-13 06:44:15

6. I want java
View Tutorial          By: A.S.Vtihyatharan at 2009-12-01 03:25:36

7. Please provide me a particular flow of validations
View Tutorial          By: Deepali at 2013-05-10 10:38:18

8. Unfortunatelly this a BAD example of to communicat
View Tutorial          By: Mladen Covic at 2013-03-28 15:08:04

9. hi i unable to retrive am getting below excepti
View Tutorial          By: vignesh at 2015-03-25 17:14:58

10. string strInsert = "Insert into [Sheet1$](F1,
View Tutorial          By: Sagar at 2011-05-12 06:47:13