Solved

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

Posted on 1998-08-01
2
163 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
Comment Utility
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
Comment Utility
Thanks for the prompt reply . I think this will work. Thanks again.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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 learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now