LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-02-2007, 10:34 PM   #1
MicahCarrick
Member
 
Registered: Jul 2004
Distribution: Fedora
Posts: 241

Rep: Reputation: 31
Check if computer can resolve host names


What would be the simplest way (in C or command-line) to check that there is an active network connection that is resolving host names? Basically, check if the internet is reachable.
 
Old 01-02-2007, 10:39 PM   #2
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
ping works pretty well.
 
Old 01-02-2007, 10:45 PM   #3
MicahCarrick
Member
 
Registered: Jul 2004
Distribution: Fedora
Posts: 241

Original Poster
Rep: Reputation: 31
I was thinking of using "net lookup" to see if it can resolve the host. You think ping would be a better choice?
 
Old 01-02-2007, 10:48 PM   #4
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
I know ping works for that purpose, and I get some quality info for free! I don't know of a specific shell command to do exactly what you want and nothing else. You could code a simple one up with gethostbyname(). (in fact, there's a recent question on that function)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot resolve names bigd Linux - Networking 1 10-09-2005 12:06 PM
i can't resolve names on the network khh80 Linux - Networking 2 07-14-2005 07:02 AM
Internal Can't Resolve Names bootface Linux - Networking 3 03-21-2005 12:00 PM
Linux gateway computer can't resolve names krsnendu Linux - Networking 4 12-17-2003 09:30 AM
Unable to resolve names Starblade Linux - Networking 1 10-25-2003 02:48 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration