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. i don't understand the input attributes can u plea
View Tutorial          By: dhanalakshmi at 2011-05-05 07:10:25

2. helpfull !!!!
View Tutorial          By: Anonymous at 2009-05-12 03:48:15

3. This is very useful for beginners.
I want f

View Tutorial          By: shankar at 2013-02-04 13:28:16

4. Thanks for a great post. Solved a problem for me i
View Tutorial          By: Mark at 2013-01-08 07:00:47

5. please give me more information
View Tutorial          By: nandhini at 2012-09-22 03:49:11

6. worked for me thanks.
View Tutorial          By: dem125 at 2010-08-03 23:30:32

7. Gud one for beginners
View Tutorial          By: puneet at 2011-07-20 05:00:42

8. Hi, from where i can download javax.comm API jar f
View Tutorial          By: Chandra at 2008-11-19 11:49:46

9. thanks f0r this p0st... it heLped me much... keep
View Tutorial          By: martz at 2009-04-29 02:27:19

10. can anyone tell me which type of device i need to
View Tutorial          By: dhanunjay at 2009-04-01 00:31:17