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:09

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. realy it was a nice basic example...and better def
View Tutorial          By: amit kumar at 2011-03-14 08:11:31

2. w0w amazing
View Tutorial          By: elvin at 2009-01-05 01:00:13

3. very superb
View Tutorial          By: bala at 2008-05-14 04:49:24

4. i want to know java coding
View Tutorial          By: carmela azarce at 2012-08-08 02:47:13

5. Hi , it was nice tutorial to understand the differ
View Tutorial          By: jagan at 2014-06-05 05:13:59

6. Can i have CreateAddressBook.java?? really need it
View Tutorial          By: KIM at 2012-12-02 11:45:20

7. it is Marvelous example.
View Tutorial          By: princevijayakumar at 2010-08-04 07:56:33

8. i need some simple java programs
View Tutorial          By: ramya at 2009-11-24 04:25:07

9. would like to have copy of clock
View Tutorial          By: jim johnson at 2008-04-10 17:30:06

10. Thanks a lot, a long time I search for solution fo
View Tutorial          By: Jonhnes at 2013-02-16 17:17:47