204 IF_RF24ETHERNET_DEBUG_CLIENT(Serial.println(); Serial.print(millis()); Serial.print(F(
" UIPClient.write: writePacket(")); Serial.print(u->packets_out); Serial.print(F(
") pos: ")); Serial.print(u->out_pos); Serial.print(F(
", buf[")); Serial.print(size - total_written); Serial.print(F(
"]: '")); Serial.write((uint8_t*)buf + total_written, payloadSize); Serial.println(F(
"'")););
243 uip_userdata_t* u = (uip_userdata_t*)uip_conn->appstate;
246 if (!u && uip_connected())
250 u = (uip_userdata_t*)EthernetClient::_allocateData();
254 uip_conn->appstate = u;
263#if UIP_CONNECTION_TIMEOUT > 0
264 if (u && u->connectTimeout > 0) {
265 if (millis() - u->connectTimer > u->connectTimeout) {
267 u->connectTimer = millis();
278 IF_RF24ETHERNET_DEBUG_CLIENT(Serial.println(); Serial.print(millis()); Serial.print(F(
" UIPClient uip_newdata, uip_len:")); Serial.println(uip_len););
279#if UIP_CONNECTION_TIMEOUT > 0
280 u->connectTimer = millis();
282 u->hold = (u->out_pos = (u->windowOpened = (u->packets_out =
false)));
287 u->state &= ~UIP_CLIENT_RESTART;
288 u->windowOpened =
false;
289 u->restartTime = millis();
290 memcpy(&u->myData[u->in_pos + u->dataCnt], uip_appdata, uip_datalen());
291 u->dataCnt += uip_datalen();
300 if (uip_closed() || uip_timedout() || uip_aborted())
308 ((uip_userdata_closed_t*)u)->lport = uip_conn->lport;
319 uip_conn->appstate = NULL;
327 u->state &= ~UIP_CLIENT_RESTART;
328 u->hold = (u->out_pos = (u->windowOpened = (u->packets_out =
false)));
329 u->restartTime = millis();
330#if UIP_CONNECTION_TIMEOUT > 0
331 u->connectTimer = millis();
336 if (uip_poll() || uip_rexmit())
341 uip_len = u->out_pos;
342 uip_send(u->myData, u->out_pos);
348 if (u->packets_out != 0 && !u->hold)
350 uip_len = u->out_pos;
351 uip_send(u->myData, u->out_pos);
362 if (u->windowOpened ==
true && u->state &
UIP_CLIENT_RESTART && millis() - u->restartTime > u->restartInterval)
364 u->restartTime = millis();
365#if defined RF24ETHERNET_DEBUG_CLIENT || defined ETH_DEBUG_L1
367 Serial.print(millis());
368 #if UIP_CONNECTION_TIMEOUT > 0
369 Serial.print(F(
" UIPClient Re-Open TCP Window, time remaining before abort: "));
373 u->restartInterval += 500;
374 u->restartInterval = rf24_min(u->restartInterval, 7000);
385 if (u->packets_out == 0)
388 uip_conn->appstate = NULL;
405#if defined ETH_DEBUG_L1
407 Serial.print(millis());
408 Serial.println(F(
" UIPClient Re-Open TCP Window"));
410 u->windowOpened =
true;
412 u->restartTime = millis();