Solved

intenet connectivity?

Posted on 2002-03-27
6
167 Views
Last Modified: 2010-03-31
i want to programatically check whether i am connected or not using JAVA?can somebody give a sample code for that?
0
Comment
Question by:anuj_roy
6 Comments
 
LVL 9

Accepted Solution

by:
Ovi earned 50 total points
ID: 6899198
Serach at google for Ping.java. In other words, you must implement a simple ping to a predefined host.
0
 
LVL 92

Expert Comment

by:objects
ID: 6900515
Not sure if there's a definitive way to check.
pinging as ovi suggested is probably the best solution, although if the machine you ping is down, or the net is slow (causing timeout) then the ping will fail making it appear that you are not connected when in fact you are.
0
 
LVL 3

Expert Comment

by:shyamkumarreddy
ID: 6901784
Yes.
Can you explain. How is apps is.

Shyam
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 3

Expert Comment

by:msterjev
ID: 6901789
boolean con=false;
try
{
     Socket s=new Socket("www.google.com",80);
     con=true;
     s.close();
}
catch(Exception e)
{
     con=false;
}

if(con)
{
   ................
}
0
 
LVL 9

Expert Comment

by:Venci75
ID: 7923734
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by: Ovi
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Venci75
EE Cleanup Volunteer
0
 

Expert Comment

by:modulo
ID: 7978412
Finalized as proposed

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
The viewer will learn how to implement Singleton Design Pattern in Java.

770 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