Arduino Yun - how to check if network connection is lost?

Hi there.
I just bought Yun board and I cant make the sketch check for network connectivity.
In Ethernet board all I was using was:

if(client.connected(ipBuf,thisPort))
  {
    Serial.println(F("connected"));

  } 
  else
  {
    Serial.println(F("failed to connect!"));
    
    return 0;
  }

What should I do to accomplish the same in Aruino Yun Board?
I try this with no luck:

Hi there.
I just bought Yun board and I cant make the sketch check for network connectivity.
In Ethernet board all I was using was: 
[code]if(client.connected())
  {
    Serial.println(F("connected"));

  } 
  else
  {
    Serial.println(F("failed to connect!"));
    
    return 0;
  }

What should I do to accomplish the same in Aruino Yun Board?[/code]

Arduino: 1.5.5-r2 (Windows 7), Board: "Arduino Yún"

yun_zoo.ino: In function 'void loop()':
yun_zoo:151: error: 'class HttpClient' has no member named 'connected'
yun_zoo:165: error: return-statement with a value, in function returning 'void'

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

I did this by using these commands,

Process p;
  p.runShellCommand("/usr/bin/pretty-wifi-info.lua | grep Signal");
char  c = p.read();
  while(p.running());
int  result = p.parseInt();

result will give you the strength of the connected wifi … after that I placed a check at the end, i.e. if result <30 then no wifi and if result >30 means wifi available.

Okay, and another solution on checking network for internet connection?

I don't know about the Yun, but this works for the RPi from the command prompt:
ip link show
or to view only eth0:
ip link show eth0

It will show either "state UP" or "state DOWN". Use GREP to determine which it is showing.

Just a thought..

hey surfertim.
Its a good thought but i need it to be able to check it through Arduino Sketch.

Great solution SurferTim!