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. grazie!!!
View Tutorial          By: Egidio De Lorenzo at 2011-04-20 12:07:25

2. this is i got error msg when i run a my program .
View Tutorial          By: anbu at 2009-04-08 02:41:17

3. so good .to give easy understand
View Tutorial          By: ashok .my no 9618738732 at 2010-02-15 06:19:48

4. This is a simple app and its working good.......
View Tutorial          By: sathish at 2012-04-23 12:16:07

5. Excellent for beginners
View Tutorial          By: PRN at 2012-05-22 09:49:15

6. introduction is very clear i get wat answer i want
View Tutorial          By: kalyan at 2013-07-02 09:23:40

7. thankyou
View Tutorial          By: gomu at 2014-07-08 09:19:13

8. nice
View Tutorial          By: rida at 2010-07-03 22:49:04

9. very useful article. every jsp resource will get g
View Tutorial          By: pechirani at 2011-06-29 04:00:49

10. Good piece of information explained wonderfully. !
View Tutorial          By: Juzar at 2009-07-23 00:24:40