- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Checking Network Connectivity
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2001 07:28 AM
07-31-2001 07:28 AM
Checking Network Connectivity
Is there any any way of checking the network connectivity using the system calls as remsh can take a lot longer to time out.
Regards,
Joseph.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2001 07:36 AM
07-31-2001 07:36 AM
Re: Checking Network Connectivity
Why not do a simple shell 'ping'?
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2001 07:37 AM
07-31-2001 07:37 AM
Re: Checking Network Connectivity
Unless you want to go to the trouble of setting up sockets, probably the easist method is to do a popen("ping remote_host -n 1","r")
and parse the results.
Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2001 08:03 AM
07-31-2001 08:03 AM
Re: Checking Network Connectivity
You could verify connectivity with one 'ping' with this script. We look for a zero percent packet loss to confirm connectivity. The argument to the script constitutes an IPaddress or hostname:
#!/usr/bin/sh
typeset HOST=${1:-localhost}
ping $HOST -n 1|grep -q "0%"
if [ $? -eq 0 ]
then
echo "$HOST is alive"
else
echo "$HOST isn't responding"
fi
#.end.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2001 08:35 AM
07-31-2001 08:35 AM
Re: Checking Network Connectivity
Since you specifically mentioned C, I had a standard signal handler I use and I simply modified it for you specific needs. The timeout for ping can vary so this way you can set the timeout to any value you choose.
The function returns 0 is the ping is good and non-zero otherwise.
Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2001 01:17 AM
08-01-2001 01:17 AM
Re: Checking Network Connectivity
I will refer to my network programming book and see if there is a quick method for testing a remote connection.
If I was testing this from a shell, I would run:
if remsh ${host} "uptime" 2>&1 | grep -v -q "load average"
then
echo "Cannot remsh to ${host}"
exit
fi
Cheers,
Joseph.