Solved

intenet connectivity?

Posted on 2002-03-27
6
176 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Title # Comments Views Activity
jboss wildfly 10.1 10 436
Crystal Reports Licensing Questions 4 64
glassfish admin console 1 23
How to fix  socket closed error 11 30
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

726 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