Reputation: 13
I used Ping command:
ping -c1 -W1 8.8.8.8
Works good if online, But in case of internet is't available or LAN is off the terminal takes long time to reply with result..
I want terminal reply in maximum time 1 or 0.5 second to use result in my
ExtendScript code:
var command = "ping -c1 -W1 8.8.8.8";
var result= system.callSystem(command);
I tried to set timeout using -t or -W but failed
Edit:
thanks to Philippe the solution is:
nc -z www.google.com 80 -G1
Upvotes: -1
Views: 2039
Reputation: 26860
If you are on MacOS Terminal, you can check internet connection by :
nc -z www.google.com 80
Upvotes: 3