LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 10-26-2006, 06:22 PM   #1
sjuk
LQ Newbie
 
Registered: Oct 2006
Posts: 7

Rep: Reputation: 0
Ping and timeout


I need to ping something and get a response fast. If the "thing" doesn't answer the dafault timeout is too long. How can i make it faster?

I think it should be something like:

ping -w0.05 10.0.0.1

but i cant get it to work.

 
Old 10-26-2006, 06:34 PM   #2
pljvaldez
Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Squeeze (x86)
Posts: 6,092

Rep: Reputation: 269Reputation: 269Reputation: 269
You can just hit Ctrl+C if it's taking too long.
 
Old 10-26-2006, 06:37 PM   #3
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 162Reputation: 162
The -w switch just tells ping how long to wait before timing out and exiting - it doesn't actually speed up the time of the response. The response time mainly depends on the network latency and can't be set using ping.
 
Old 10-27-2006, 02:59 AM   #4
sjuk
LQ Newbie
 
Registered: Oct 2006
Posts: 7

Original Poster
Rep: Reputation: 0
Thanx guys, but it's not what i need.

I'm making a php script to ping a large wlan. That means every time the page loads it will ping about 200 routers. If six of those routers are offline i will have to wait 1 minute for the page to load with the default timeout. If one of the routers dont responde in 50ms I can assume there is something wrong, and it should time out.

shell_exec("ping -c1 -t0.05 10.0.0.51");

works fine on windows, but on linux the timeout is just to long.

Please help!

 
Old 10-27-2006, 04:03 PM   #5
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 162Reputation: 162
My apologies - I see what you mean. I haven't been able to get -w working for values less than 1 second here.
Code:
$ time ping -w 1 -c1 165.86.4.1
PING 165.86.4.1 (165.86.4.1) 56(84) bytes of data.

--- 165.86.4.1 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 999ms


real    0m1.005s
user    0m0.000s
sys     0m0.004s
Setting TTL with -t 1 gives the following results here though:
Code:
$ time ping -t 1 -c1 165.86.4.1
PING 165.86.4.1 (165.86.4.1) 56(84) bytes of data.
From 203.55.xxx.8 icmp_seq=1 Time to live exceeded

--- 165.86.4.1 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms


real    0m0.018s
user    0m0.000s
sys     0m0.000s
$ time ping -t 1 -c1 localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.074 ms

--- localhost ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.074/0.074/0.074/0.000 ms

real    0m0.003s
user    0m0.000s
sys     0m0.000s
 
Old 10-31-2006, 04:44 AM   #6
sjuk
LQ Newbie
 
Registered: Oct 2006
Posts: 7

Original Poster
Rep: Reputation: 0
Hi again and thanx for the reply.

Still cant get it to work. Maybe its the shell_exec command that works differently on linux and this post should in a php forum. Ill look around.

Thanx again

sic
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
VPNC seems to timeout quickly- how do I lengthen the timeout? spiffytech Linux - Software 28 01-03-2014 06:45 AM
Strange Ping Issue - Can't ping localhost but can ping others on LAN code_slinger Linux - Networking 13 03-17-2011 03:47 AM
windows 98 m/c ping to ip address of red hat server but fails to ping hostname ravilohot Linux - Networking 2 09-07-2004 05:57 AM
Eggdrop has quit (Ping timeout: 181 seconds) Kroppus Linux - Software 0 11-13-2003 12:32 PM
lan problems (ping timeout) Bungholio Linux - Networking 11 07-07-2003 02:29 PM


All times are GMT -5. The time now is 11:54 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration