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. Is operator overloading possible in java??????
View Tutorial          By: rishi at 2008-11-01 23:55:55

2. Well explained. Example clear out the diff
View Tutorial          By: sonam at 2014-06-25 19:05:20

3. I want to download that 5 sms sending program .fro
View Tutorial          By: anwar at 2008-09-08 02:22:06

4. I executed your code but i get the error "OK
View Tutorial          By: Denzil at 2013-01-18 09:33:37

5. thanks
View Tutorial          By: snooker at 2013-02-04 19:45:40

6. I writing a main class in the eclipse IDE and call
View Tutorial          By: adam lim at 2013-03-11 04:13:51

7. Plse Send me The Code For Sms Application to My Ma
View Tutorial          By: Santoshb at 2010-09-08 07:08:55

8. Good examples. However... I am testing for a Hex v
View Tutorial          By: Doug Whitehead at 2008-11-29 17:10:43

9. hi,
i have tried to download the sun api fr

View Tutorial          By: raghu at 2009-01-07 05:45:33

10. Thks a lot..... The way of giving explanation and
View Tutorial          By: Hari at 2011-04-08 02:58:06