Solved

How Do I check if I can connect to a system from java

Posted on 1998-08-01
2
191 Views
Last Modified: 2010-03-30
From my program I want to check if I can connect to a URL if not exit gracefully
0
Comment
Question by:vas1
2 Comments
 
LVL 2

Accepted Solution

by:
aziz061097 earned 100 total points
ID: 1230039
SecurityManager sm = System.getSecurityManager();

if (security != null)
{
try
  {
  sm.checkConnect("www.experts-exchange.com",80);
  }
  catch(SecurityException ex)
  {
   // catch exceptions
  }
}
0
 

Author Comment

by:vas1
ID: 1230040
Thanks for the prompt reply . I think this will work. Thanks again.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question