Inconsistency using UDP with two ESP8266's

Hi, only for my convenience to keep them separate (and I wasn't sure if it was ok to use the same port in both devices). The Master knows which to reply to based on the following two bits of code...

// Slave board 1 IP address and port
const char* slave1IP = "192.168.4.11";
const unsigned int slave1Port = 8081;

// Slave board 2 IP address and port
const char* slave2IP = "192.168.4.12";
const unsigned int slave2Port = 8082;

and

  if (receivedMessage == "1111") {
    //  Reply to Slave 1
    udp.beginPacket(slave1IP, slave1Port);
    //    udp.beginPacket(APIP, slave1Port);
    udp.print(replyForSlave1);
    udp.endPacket();
    Serial.print("Just sent a reply to Slave 1 at IP ");
    Serial.print(slave1IP);
    Serial.print(" and Port ");
    Serial.println(slave1Port);
    Serial.println();
    receivedMessage = "";
  }

  if (receivedMessage == "2222") {
    //  Reply to Slave 2
    udp.beginPacket(slave2IP, slave2Port);
    udp.print(replyForSlave2);
    udp.endPacket();
    Serial.print("Just sent a reply to Slave 2 at IP ");
    Serial.print(slave2IP);
    Serial.print(" and Port ");
    Serial.println(slave2Port);
    Serial.println();
    receivedMessage = "";
  }

It all depends on what message the Master received that it then knows where it came from i.e. "1111" or "2222".

I used UDP originally as I got the impression from what I had read that it was a very simple protocol and that I could then just create my own check, reply and re-send routines where necessary. Maybe TCP would have been better? Do you think it would be any more reliable?

Thanks.