Solved

intenet connectivity?

Posted on 2002-03-27
6
170 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
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.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Title # Comments Views Activity
table example 4 32
ejb on wildfly 5 30
difference between sorce folder and folder in eclipise 3 28
java mysql insert application 14 25
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

792 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