I believe I'm trying to fix something quite easy. Still I'm having issues unfortunately.


With my windows forms I'm sending a UDP packet which contains a 3 digits number (for example: `101` ) and a string with a task `"_available"`.


Now my device, who captures the packet should read this as a ID and a task. If it is his ID, then he has to execute the task.


I'm sure the message arrives correctly, for debug I did a simple string comparison`!strcmp(packetBuffer, "101_available"));`, which works. Also, I can see in console that the devices receives the messages correctly, so here is the dumb part;
Somehow I can't get the code correctly to make a correct comparison.


I've tried three things so far.


First of all I've tried to compare the incoming PacketBuffer (tableID is defined as byte, this works best):


Code:
      if (packetBuffer,UDP_TX_PACKET_MAX_SIZE){   
        if(packetBuffer == tableID + "_available"){
        modeAvailable();
        }
Secondly, I tried
Code:
strstr
as comparison


Code:
      if (strstr(packetBuffer, tableID +  "_available")) {
        modeAvailable();
      }
I also tried it like this:
Code:
if (strstr(packetBuffer, tableID +  "_available")== packetBuffer));
Finally I also tried:


Code:
      if (strcmp(packetBuffer, "{0}_available")) {
        if(packetBuffer == tableID + "_available"){
        modeAvailable();


In all cases, I can read the packet just like I want it and how I expect it to be.
So the only thing that goes wrong is that the If statements are not returning true.
I'm also sure that the TableID is set correctly (this is programmed in the EEPROM)




Does anyone know what goes wrong here?