Although I don't quite see why this question could not have been added to your other thread, one thing I noticed immediately
You are sending via
client.send(message, 0, message.length, PORT, HOST, function(err, bytes)
(message.length of var message = 'ping' will be 4)
and then copy the incoming packet (which is only four bytes long as the zero-terminator is not sent) like that
for (int i = 0; i < strlen(data); i++) {
cmd[i] = data[i];
}
So even if data was containing the zero-terminator (which it most likely won't due to lacking initialisation) you'd only copy four characters (again without the zero-terminator) and hence
if (strcmp(cmd, "ping") == 0) {
will most likely not signal equality.
Some basic debugging steps (like adding Serial.println(data) and Serial.println(cmd)) should help testing this hypothesis in no time (and wouldn't be too much to ask for before consulting others).
BTW, failing to initialise local variables was also a point in this thread of yours