WiFi.Ping() returns -120 on Argon

My Argon can connect to the network and connect to the Particle cloud. I am trying to test my Argon’s ability to reach devices on the network, and can’t seem to understand what WiFi.Ping() is doing for me. Everything I try returns -120. Does that mean that it can’t reach the destination, or what?

The code and the results I get are shown below.

The Code

IPAddress remoteIP(10, 245, 77, 21);
int numberOfReceivedPackage = 0;

void setup() {

void loop() {

    while(!Serial.available()) SPARK_WLAN_Loop();
    Serial.println("Pinging started...");
    numberOfReceivedPackage = WiFi.ping(remoteIP, 25);
    Serial.print("Pinging ended ->");

The Results
Pinging started...
Pinging ended ->-120

Is your ping target actually responding to pings? If not WiFi.ping() will just timeout.
Have you tried pinging that IP from your computer?

BTW, SPARK_WLAN_Loop() has been superceded ages ago by Particle.process().

1 Like

Thats a good point. I had the Argon pinging itself. I pinged it from my PC and saw that it didn’t respond to pings.

I changed it so the Argon would ping my PC, but got the same -120.
I have tried pinging google.com and particle.io using the IP address resolved by ping from my PC, and got the same -120 response.

I didn’t realize that. I got the ping code from the forum here, and did the ol’ cut and paste. I’ll read up on the particle.process()

Using Argon device. When trying to ping, just like @ jwheasi, I only get -120 no matter what I do.
I don’t really need to ping, I need to scan an IP range from x.x.x.1 to x.x.x.255, to make a list of what is active (ping or port 80). Does anyone have a solution to the ping issue, or an alternative that doesn’t take 20 seconds per client.connect() request?

Thanks for taking the time to read this.

The reason I was getting a -120 was because the Argon was on my companies network that was seeing it as an unrecognized device. Therefore the corporate server gave it an IP address, but isolated it so that it couldn’t access a darn thing. Which was a real PITA to figure out.

So my issue was a networking issue, and not an Argon issue.

Are you sure? Look this

int inet_ping(const HAL_IPAddress* address, network_interface_t nif, uint8_t nTries, void* reserved) {