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. My code:

$hex=array('C4028000','457

View Tutorial          By: Mark at 2015-02-02 14:42:56

2. Thanks it helped to understand but error occurred
View Tutorial          By: Maya at 2010-11-17 22:08:10

3. Hello Ramlak, I am too getting
java.lang.U

View Tutorial          By: Amruta at 2008-11-07 23:56:17

4. Question, how much is Struts 2 used today? As a fr
View Tutorial          By: Marco at 2012-10-04 06:34:43

5. good
View Tutorial          By: jonas at 2013-04-05 12:00:10

6. Thanks for the tutorial. I didn't get a lot of tra
View Tutorial          By: jordan at 2012-05-16 13:03:45

7. The site is too informative. I just like their imm
View Tutorial          By: Priyadarshi Tripathi at 2010-10-26 23:44:46

8. thanks to this site which get me understand about
View Tutorial          By: Sayak at 2012-10-08 15:57:25

9. it is really best site for the information.many ti
View Tutorial          By: panchanan ruata at 2013-05-22 09:36:37

10. Easy and Wonderfulimple Example...to undersatnd th
View Tutorial          By: Chaitanya at 2010-04-04 02:27:04