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



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. Thank you very much for your help,
this co

View Tutorial          By: AA at 2011-09-09 14:24:45

2. Great stuff - helped me setting up the company SQL
View Tutorial          By: JW at 2011-07-11 12:09:19

3. Thankx, the information was of great use, I apprec
View Tutorial          By: sachin at 2008-12-13 03:37:11

4. hello
thanks for your code. Please could an

View Tutorial          By: Bruno at 2009-05-28 15:38:46

5. Very good explaination of transient and volatile.
View Tutorial          By: Himanshu Upadhyay at 2010-11-15 04:48:43

6. thanks..very nice and easy to understand for new j
View Tutorial          By: Ranjan at 2011-07-22 08:34:50

7. dis prgrm is not giving me any ouput..i need to re
View Tutorial          By: singh at 2015-02-19 12:16:31

8. if the "extend" word is not present does
View Tutorial          By: detteskii at 2011-06-27 09:12:23

9. Good,

Thank you man.

View Tutorial          By: Goldo at 2010-07-12 14:56:14

10. In the case of Basic validation is it must to spec
View Tutorial          By: Uma shankar at 2014-07-09 00:58:05