My Argon, which is connected to the Device Cloud and that can be pinged from my several PCs in my network is unable to ping any other device (neither the gateway nor any other resource e.g. 8.8.8.8).
DNS resolutions works as expected.
Maybee I’m missing some important steps.
Best regards
// Use primary serial over USB interface for logging output
SerialLogHandler logHandler(LOG_LEVEL_ALL, { // Logging level for non-application messages
{ "app", LOG_LEVEL_ALL } // Logging level for application messages
});
// polling interval
const long interval = 2000;
// setup() runs once, when the device is first turned on.
void setup() {
// Put initialization like pinMode and begin functions here.
// Format text message
Log.info("System version: %s", (const char*)System.version());
}
unsigned long lastTime = 0;
// loop() runs over and over again, as quickly as it can execute.
void loop() {
// The core of your code will likely live here.
unsigned long now = System.millis();
if ((now - lastTime) >= interval) {
lastTime = now;
while (!WiFi.ready()) {
Particle.process();
}
Log.trace("Wifi available");
Log.info("ip: %s", WiFi.localIP().toString().c_str());
Log.info("subnet: %s", WiFi.subnetMask().toString().c_str());
Log.info("gateway: %s", WiFi.gatewayIP().toString().c_str());
Log.info("Pinging started...");
IPAddress remoteIP(8, 8, 8, 8);
remoteIP = WiFi.resolve("www.google.com");
if(remoteIP) {
// IP address was resolved
Log.info("ip address: %s", remoteIP.toString().c_str());
int numberOfReceivedPackage = WiFi.ping(remoteIP, 10);
Log.info("ping res=%d", numberOfReceivedPackage);
} else {
// name resolution failed
Log.error("Resolution failed");
}
}
}
Hey! Interesting finding; Wifi.ping() was not implemented on the Argon. I’ve raised this gap internally to request that either documentation is adjusted and/or this API implementation is adopted.
In the meantime, our Engineering Team has the following implementation via the Gen3 Socket API: particle_gen3_ping.cpp · GitHub