Comment on Tutorial - Simple Port Scanner application using Java By Syed M Hussain



Comment Added by : mobinga

Comment Added at : 2011-07-25 15:08:27

Comment on Tutorial : Simple Port Scanner application using Java By Syed M Hussain
Your code is syntactically correct, but semantically wrong.
You have to put the output statement within the catch blocks!

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" + i + "Not in Use");}

}


View Tutorial



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. Thanks For This Explanatory Tutorial .
View Tutorial          By: Pralay at 2013-06-15 03:50:26

2. hi this is from Ashok....
can you send the

View Tutorial          By: Ashok at 2015-04-16 11:51:51

3. Hi Dear All

How to do strike-out in

View Tutorial          By: Sandeep Mehta at 2012-11-21 06:54:06

4. Thanks.It helps a lot to me.
View Tutorial          By: Sachin at 2013-05-24 19:36:36

5. I want to get SCJP certification. please anyone c
View Tutorial          By: Raju Salla at 2012-05-04 08:38:06

6. need to be place taglig in the <jsp-config>
View Tutorial          By: Shaik Basha at 2013-01-30 03:11:41

7. Brief but Comprehensive. Excellent Effort.
View Tutorial          By: Farooq at 2011-11-16 14:14:52

8. someone explain how to use PreparedStatements with
View Tutorial          By: Manikprabhu at 2011-03-26 00:04:54

9. int m,m2,n,n2;
for( m=0 , m2=0 ; m<

View Tutorial          By: muhammad abdullah at 2012-10-11 05:27:02

10. this helped a lot!!!!
View Tutorial          By: karthik rk at 2012-09-04 16:32:25