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. I am able to iterate the list.Now i want to print
View Tutorial          By: akanksha at 2012-09-26 05:25:12

2. lots of thanks for this given example........hope
View Tutorial          By: virgi crisostomo at 2010-08-18 17:18:08

3. Hey i see some lines of code in order to displpay
View Tutorial          By: Bala at 2013-01-09 13:58:48

4. Sorry about this. I cannot run this program becaus
View Tutorial          By: TanSW at 2008-04-28 20:14:20

5. its gud 2 learn java sim prog
View Tutorial          By: Rakesh at 2009-10-04 03:47:01

6. Hi Blackpanther, the mode is either 0 or 1. If you
View Tutorial          By: Ramlak at 2008-04-01 02:24:14

7. Thanks...
View Tutorial          By: SHUVO at 2015-07-01 21:20:47

8. There was no sharing of volatile variable in the p
View Tutorial          By: Rajesh Poppoppu at 2011-12-30 13:04:42

9. Hi Andi, Stig and Derick!

Nice tur

View Tutorial          By: Lasse Christiansen at 2010-05-01 01:58:14

10. pls help me how to solve the timeout problem

View Tutorial          By: nisha at 2010-09-20 22:29:17