ESP8266 Stops Working?

I swear I had this working at one point. But, recently, I pulled up my old sketches and flashed them to my NodeMCU 0.9's and now they no longer work. Hoping someone with some experience with ESP8266's can give me some guidance.

All I'm trying to do is send a single word (String) from one ESP8266 to the other once every few seconds. The sequence is supposed to go like this:

ESP8266 #1 comes online, configured in STA+AP
ESP8266 #2 comes online, configured in STA, connects to ESP8266 #1's AP
ESP8266 #1 sends ESP8266 #2 a message ('status/r'). ESP8266 #2 responds ('active/r').
ESP8266 #1 sends a message every couple of seconds to ESP8266 #2. ESP8266 #2 writes to serial what it receives.

That's it! But, for some reason, this procedure works all the way until the end, then stops working. ESP8266 #2 will receive the first couple of Strings from #1, then it just stop receiving them. It's like it gives 10 good seconds of connectivity, then it just drops out.

I can tell on the serial monitor of ESP8266 #1 that the connection has dropped (or that ESP8266 #2 has stopped listening) because while I only have a 1 second delay programmed in, it will take several seconds between communication attempts. That appears to be because the command (client.println(String)) has to time all the way out before it tries again.

How can I keep ESP8266 #1 and ESP8266 #2 connected in perpetuity? Am I running afoul of some limit I'm not aware of, or do I have to re-insatiate the connection on each pass of the loop or something?

This obviously isn't the real code, but here's a dumbed down example of what the code is approximately like for reference.

ESP8266 #1:

WiFiClient client
void setup {
WiFi.mode(WIFI_AP_STA);
WiFi.softAPConfig(ap, ap, IPAddress(255, 255, 255, 0));
WiFi.softAP(ssid);
client.connect(targetIP, 80);
}
void loop {
client.println('string1/r');
delay(1000);
client.println('string2/r');
delay(1000);
client.println('string3/r');
}

ESP8266 #2:

WiFiServer server(80);
void setup {
WiFi.mode(WIFI_STA)
WiFi.begin(ssid);
server.begin();
}
void loop {
WiFiClient client = server.available();
if (client) {
if (client.connected) {
for (int i=1; i>0; i++) {
String message = client.readStringUntil('\r');
Serial.println(message);
}
}
}
}

With the WiFiEsp library i use you have to close the connection after each message then reconnect to said ip "client.connect(targetIP, 80);" and send another message and then close "client.close()", and so on... and also you forgot to add a delay after client.println('string3/r');

ESP8266 #1:

WiFiClient client

void setup {
WiFi.mode(WIFI_AP_STA);
WiFi.softAPConfig(ap, ap, IPAddress(255, 255, 255, 0));
WiFi.softAP(ssid);
}

void loop {
client.connect(targetIP, 80);
delay(2000); //idk
client.println('string1/r');
delay(1000);
client.println('string2/r');
delay(1000);
client.println('string3/r');
delay(1000);
client.close();
delay(1000);
}

if your just sending such simple info you could save loads of space and just use the at commands
http://www.instructables.com/id/Getting-Started-With-the-ESP8266-ESP-01/ and instead of using the serial monitor to send the commands just use serial.print from your arduino and the AT commands plus a small delay you can even use serial.find("OK") to see if each command has processed and ready for the next, or whatever the responce should be for the command, test from the serial monitor first to see what each should be.

KawasakiZx10r:
instead of using the serial monitor to send the commands just use serial.print from your arduino and the AT commands plus a small delay you can even use serial.find("OK") to see if each command has processed and ready for the next

This is very interesting to me, though it exposes a gap in my understanding here.

Firstly, I'm not using an Arduino at all, I'm just using the ESP8266. So, can I use AT commands to just send a single string or integer from one ESP8266 to the other? I've looked online but every article about the ESP8266 and AT commands seems to be talking about using the Arduino to communicate with a physically connected ESP8266.