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. really superb in simple english with examples. Exp
View Tutorial          By: hariharan at 2009-01-14 22:22:32

2. hi, ashray p shetty
can you please tell me

View Tutorial          By: amrish at 2010-12-12 07:30:49

3. hey..
shouldn't the 2nd java code have an o

View Tutorial          By: izzie at 2010-04-06 11:34:34

4. Where should the file be placed? How do I know wh
View Tutorial          By: Anon at 2009-07-23 14:08:17

5. nice tutorial
View Tutorial          By: Rakesh at 2012-05-30 01:13:00

6. it is very useful and in understandable manner
View Tutorial          By: Deepika at 2012-03-26 05:10:15

7. This Tutorial website is very usefull in my java p
View Tutorial          By: V.GeorgeFernandas at 2012-11-26 13:20:59

8. This is the solution that I also used, however, th
View Tutorial          By: Rob Ingenthron at 2012-07-18 23:06:18

9. send me SMS RECEIVE code please
View Tutorial          By: Butler at 2008-04-26 05:33:40

10. My Friend,

Thank you so much for ex

View Tutorial          By: Bikash at 2010-05-30 00:15:26