Internet status on Arduino YUN with ClientConnected()

Hello friends, I am trying to make a script that identifies when my Arduino YUN is connected to the internet and when it is not. To do this I thought of using the connected () function I used in my plate Wifly, but is that code does not work on me and tells me all the time in the Serial monitor is not connected to internet being that if this.

This is the code, but if someone please recommend me another way c:

#include <Bridge.h>
#include <YunServer.h>
#include <YunClient.h>

YunServer server;

void setup() {
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);
  digitalWrite(13, HIGH);
  YunClient client = server.accept();

  if (client.connected()) {
  } else {
    Serial.println("fallo de conexión");

void loop() {
  // put your main code here, to run repeatedly:


Connected as a client or connected as a server? Neither connected lasts long - only long enough to satisfy the connecting client's request, in the case of a server or only long enough to collect the server's response in the case of a client.

That the device is able to make a GET request or able to handle client connects is NOT the same as being connected to the internet.

Of course, in this case I am evaluating as a client. But as you say, how could test if connected to internet or not?

But as you say, how could test if connected to internet or not?

If you get a response, you were connected. If not, you weren't.

Anything to do with the internet and/or using the you as a server/client should be done of the YUN's linux processor and not on the AVR. Look in the YUN's own forum.