Ethercard UDPlistener incoming data

I have a nano with a enc28j60 to which i've a working udpListener sketch as per the included library.

What i'm trying to achieve is to send a UDP of wither a "H" or "L" which for testing purposes turns an LED on and off, whilst also printing to the serial port.

Below is the included function i've modified from the ethercard library

void udpSerialPrint(uint16_t dest_port, uint8_t src_ip[IP_LEN], uint16_t src_port, const char *data, uint16_t len){
  IPAddress src(src_ip[0],src_ip[1],src_ip[2],src_ip[3]);

  Serial.print("dest_port: ");
  Serial.println(dest_port);
  Serial.print("src_port: ");
  Serial.println(src_port);


  Serial.print("src_port: ");
  ether.printIp(src_ip);
  Serial.println("data: ");
  Serial.println(data);

  //my added code
  if (data == "H"){
    digitalWrite(ledPin, HIGH);
    Serial.print("LED ON");
  }

   if (data == "L"){
    digitalWrite(ledPin, LOW);
    Serial.print("LED OFF");
  }
}

With the serial terminal open I can see that the nano is receiving the UDP character, but isn't acting upon it.
Form my rather limited programming knowledge I suspect its something to do with it incorrectly reading the data out of the buffer. The data is declared as a const char and given the variable *data as per the included example, however when it is printed to the serial terminal

Serial.println(data);

the above works and prints the character to the terminal but the below doesn't print or turn the led pin high or low

if (data == "L"){

Any help would be greatly appreciated

if (data == 'L'){

You want to compare the received char to a character literal, not a string literal, because the string literal has an included null character.

"data" is a pointer, you cannot compare directly a pointer to a value.

If "data" is a cstring, you can use strcmp() to compare:

if (strcmp(data, "H")) {

If not, you will have to test each element in "data".

If "data" is a cstring, you can use strcmp() to compare:

Be aware, though, that 0 (false) means that the strings DO match.

PaulS:
Be aware, though, that 0 (false) means that the strings DO match.

Yes. My bad. It should be:

if (strcmp(data, "H") == 0) {

Brilliant! Thats working perfectly now. If i'd have known what to search for in the forums I could have probably had something working.
Thanks for the help.

Now to get it transmitting back...