Edit AllPages

If you’re looking for a very quick and simple way to add synchronous ICMP ping support to your app, here’s how:

#define printf #define fflush

This stops the code from dumping all those printf messages to the console. Now we need to change the code to return the number of ping packets we successfully received:

int SimplePing(const char* HostToPing, const int NumberOfPacketsToSend, const int PingTimeoutInSeconds, const int ReturnimmediatelyAfterReply, int *numberPacketsReceived );

That’s it. It’s a bit of a hack, but if you’re in a hurry it’ll do the trick.