ESP8266 & deepSleep(): delays on networking stack

I have a “slight” problem with my ESP8266 (Wimos D1): It connects to a WPA2 AP within 500 ms, but all packages sent to the network within the first ~ 2500 ms after connect are silently dropped. I was thinking, it could be the ARP that takes “some” time, but that’s not the case: the ARP discovery is done just a tick before the first UDP packet is passed to the network.

So what does the ESP do in this 2.5 seconds after the connection to the AP is established till the first user generated packet is sent to the network? Is there a way to tell if the ESP is ready to send packages? WiFi.status() always return WL_CONNECTED.

The second thing: Has somebody found a way to reactivate WiFi, when the ESP has been sent init deep sleep with ESP.deepSleep( 5000000, WAKE_RF_DISABLED ); ?

# tcpdump -i wlan0 src 192.168.1.11 -A
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on wlan0, link-type EN10MB (Ethernet), capture size 262144 bytes
21:29:46.025007 ARP, Request who-has x61.lan tell 192.168.1.11, length 28
........$b...#..............
21:29:46.032136 IP 192.168.1.11.9999 > x61.lan.9999: UDP, length 18
E.........7.........'.'...,c TEST < 11 > TEST 
21:29:46.032795 IP 192.168.1.11.9999 > x61.lan.9999: UDP, length 18
E.........7.........'.'...,b TEST < 12 > TEST 
21:29:46.034992 IP 192.168.1.11.9999 > x61.lan.9999: UDP, length 18
E.........7.........'.'...,a TEST < 13 > TEST 
21:29:46.275915 IP 192.168.1.11.9999 > x61.lan.9999: UDP, length 18
E.........7.........'.'...,` TEST < 14 > TEST 
21:29:46.526660 IP 192.168.1.11.9999 > x61.lan.9999: UDP, length 18
E.........7.........'.'...,_ TEST < 15 > TEST 
21:29:46.777086 IP 192.168.1.11.9999 > x61.lan.9999: UDP, length 18
E.........7.........'.'...,^ TEST < 16 > TEST 
21:29:47.027798 IP 192.168.1.11.9999 > x61.lan.9999: UDP, length 18
E.........7.........'.'...,] TEST < 17 > TEST 
21:29:47.278243 IP 192.168.1.11.9999 > x61.lan.9999: UDP, length 18
E.........7.........'.'...,\ TEST < 18 > TEST 
21:29:47.528928 IP 192.168.1.11.9999 > x61.lan.9999: UDP, length 18
E.........7.........'.'...,[ TEST < 19 > TEST 
21:30:06.311691 ARP, Request who-has x61.lan tell 192.168.1.11, length 28
........$b...#..............
21:30:06.314734 IP 192.168.1.11.9999 > x61.lan.9999: UDP, length 18
E.........7.........'.'...,c TEST < 11 > TEST 
21:30:06.319197 IP 192.168.1.11.9999 > x61.lan.9999: UDP, length 18
E.........7.........'.'...,b TEST < 12 > TEST 
21:30:06.320919 IP 192.168.1.11.9999 > x61.lan.9999: UDP, length 18
E.........7.........'.'...,a TEST < 13 > TEST 
21:30:06.562878 IP 192.168.1.11.9999 > x61.lan.9999: UDP, length 18
E.........7.........'.'...,` TEST < 14 > TEST 
21:30:06.813069 IP 192.168.1.11.9999 > x61.lan.9999: UDP, length 18
E.........7.........'.'...,_ TEST < 15 > TEST 
21:30:07.063750 IP 192.168.1.11.9999 > x61.lan.9999: UDP, length 18
E.........7.........'.'...,^ TEST < 16 > TEST 
21:30:07.314085 IP 192.168.1.11.9999 > x61.lan.9999: UDP, length 18
E.........7.........'.'...,] TEST < 17 > TEST 
21:30:07.564853 IP 192.168.1.11.9999 > x61.lan.9999: UDP, length 18
E.........7.........'.'...,\ TEST < 18 > TEST 
21:30:07.815330 IP 192.168.1.11.9999 > x61.lan.9999: UDP, length 18
E.........7.........'.'...,[ TEST < 19 > TEST

Code:

#include <ESP8266WiFi.h>
#include <WiFiUdp.h>

const char* ssid = "XXXXXX";
const char* password = "XXXXXXX";


void setup()
{
  WiFi.persistent( false );   // Ganz wichtig! Sonst schreibt das Ding errer ins Flash und funktioniert nach ein paar Stunden nicht mehr!
  pinMode(D0, WAKEUP_PULLUP); // deepSleep(): D0 und RESET müssen direkt verbunden werden

  Serial.begin(74880);
  Serial.println();

  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);

  IPAddress ip(192, 168, 1, 11);
  IPAddress gateway(192, 168, 1, 1);
  IPAddress subnet(255, 255, 255, 0);
  WiFi.config(ip, gateway, subnet);

  while (WiFi.status() != WL_CONNECTED) delay(10);

  Serial.println("send");

  WiFiUDP Udp;
  char c[128];
  Udp.begin(9999);
  for (int i = 0; i < 20; i++) {
    sprintf(c," TEST < %d > TEST ",i);
    Serial.println(c);
    Serial.println(WiFi.status());
    Udp.beginPacket(IPAddress(192, 168, 1, 190), 9999);
    Udp.write(c,strlen(c));
    Udp.endPacket();
    delay(250);
    Serial.println(WiFi.status());
    Serial.println(millis());
  }

  //delay(4000);

  ESP.deepSleep( 15000000, WAKE_RF_DEFAULT );
  //ESP.deepSleep( 15000000, WAKE_RF_DISABLED );
  delay(10);
}

void loop() { }