     } while (nibegw.messageStillOnProgress());
   }
 
-  if (!ethernetInitialized)
-  {
-    if (now >= ETH_INIT_DELAY)
-    {
-      DEBUG_PRINT(1, "Initializing Ethernet\n");
-      initializeEthernet();
+  if (!ethernetInitialized && now >= ETH_INIT_DELAY)
+  {
+    initializeEthernet();
+  }
+}
+
+// ######### FUNCTIONS #######################
+
+void initializeEthernet()
+{
+  DEBUG_PRINT(1, "Initializing Ethernet\n");
+  Ethernet.begin(mac, ip, gw, mask);
+
+#ifdef PRODINO_BOARD
+  W5100.setRetransmissionCount(1);
+#endif
+
+  ethernetInitialized = true;
+  udp.begin(INCOMING_PORT_READCMDS); 
+  udp4writeCmnds.begin(INCOMING_PORT_WRITECMDS);
+
 #ifdef ENABLE_DEBUG
-      DEBUG_PRINTDATA(0, "%s ", BOARD_NAME);
-      DEBUG_PRINTDATA(0, "version %s\n", VERSION);
-      sprintf(debugBuf, "MAC=%02X:%02X:%02X:%02X:%02X:%02X\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
-      DEBUG_PRINT(0, debugBuf);
-      sprintf(debugBuf, "IP=%d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]);
-      DEBUG_PRINT(0, debugBuf);
-      sprintf(debugBuf, "GW=%d.%d.%d.%d\n", gw[0], gw[1], gw[2], gw[3]);
-      DEBUG_PRINT(0, debugBuf);
-      sprintf(debugBuf, "TARGET IP=%d.%d.%d.%d\n", TARGET_IP);
-      DEBUG_PRINTDATA(0, "TARGET PORT=%d\n", BOARD_NAME);
-      DEBUG_PRINTDATA(0, "ACK_MODBUS40=%s\n", ACK_MODBUS40 ? "true" : "false");
-      DEBUG_PRINTDATA(0, "ACK_SMS40=%s\n", ACK_SMS40 ? "true" : "false");
-      DEBUG_PRINTDATA(0, "ACK_RMU40=%s\n", ACK_RMU40 ? "true" : "false");
-      DEBUG_PRINTDATA(0, "SEND_ACK=%s\n", SEND_ACK ? "true" : "false");
-      DEBUG_PRINTDATA(0, "ETH_INIT_DELAY=%d\n", ETH_INIT_DELAY);
-      DEBUG_PRINTDATA(0, "RS485_DIRECTION_PIN=%d\n", RS485_DIRECTION_PIN);
-#endif
-    }
-  }
-}
-
-// ######### FUNCTIONS #######################
-
-void initializeEthernet()
-{
-  Ethernet.begin(mac, ip, gw, mask);
-  ethernetInitialized = true;
-  udp.begin(TARGET_PORT);  
-  udp4readCmnds.begin(INCOMING_PORT_READCMDS);
-  udp4writeCmnds.begin(INCOMING_PORT_WRITECMDS);
+  DEBUG_PRINTDATA(0, "%s ", BOARD_NAME);
+  DEBUG_PRINTDATA(0, "version %s\n", VERSION);
+  sprintf(debugBuf, "MAC=%02X:%02X:%02X:%02X:%02X:%02X\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+  DEBUG_PRINT(0, debugBuf);
+  sprintf(debugBuf, "IP=%d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]);
+  DEBUG_PRINT(0, debugBuf);
+  sprintf(debugBuf, "GW=%d.%d.%d.%d\n", gw[0], gw[1], gw[2], gw[3]);
+  DEBUG_PRINT(0, debugBuf);
+  sprintf(debugBuf, "TARGET IP=%d.%d.%d.%d\n", TARGET_IP);
+  DEBUG_PRINT(0, debugBuf);
+  DEBUG_PRINTDATA(0, "TARGET PORT=%d\n", TARGET_PORT);
+  DEBUG_PRINTDATA(0, "INCOMING_PORT_READCMDS=%d\n", INCOMING_PORT_READCMDS);
+  DEBUG_PRINTDATA(0, "INCOMING_PORT_WRITECMDS=%d\n", INCOMING_PORT_WRITECMDS);
+  DEBUG_PRINTDATA(0, "TARGET PORT=%d\n", TARGET_PORT);
+  DEBUG_PRINTDATA(0, "ACK_MODBUS40=%s\n", ACK_MODBUS40 ? "true" : "false");
+  DEBUG_PRINTDATA(0, "ACK_SMS40=%s\n", ACK_SMS40 ? "true" : "false");
+  DEBUG_PRINTDATA(0, "ACK_RMU40=%s\n", ACK_RMU40 ? "true" : "false");
+  DEBUG_PRINTDATA(0, "SEND_ACK=%s\n", SEND_ACK ? "true" : "false");
+  DEBUG_PRINTDATA(0, "ETH_INIT_DELAY=%d\n", ETH_INIT_DELAY);
+  DEBUG_PRINTDATA(0, "RS485_DIRECTION_PIN=%d\n", RS485_DIRECTION_PIN);
+#endif
 }
 
 void nibeCallbackMsgReceived(const byte* const data, int len)


void debugPrint(char* data)
{
  if (ethernetInitialized)
  {
    udp.beginPacket(targetIp, TARGER_DEBUG_PORT);
    udp.write(data);
    udp.endPacket();
  }

#ifdef PRODINO_BOARD
  Serial.print(data);

  {
    if (token == READ_TOKEN)
    {
      DEBUG_PRINT(3, "Read token received from nibe\n");
      int packetSize = udp.parsePacket();
      if (packetSize) {
        len = udp.read(data, packetSize);
        DEBUG_PRINTDATA(2, "Send read command to nibe, len=%d, ", len);
        DEBUG_PRINT(1, " data in: ");
        DEBUG_PRINTARRAY(1, data, len)
        DEBUG_PRINT(1, "\n");
#ifdef TRANSPORT_ETH_ENC28J60
        udp.flush();
        udp.stop();
        udp.begin(INCOMING_PORT_READCMDS);
#endif
      }
    }
    else if (token == WRITE_TOKEN)
    {
      DEBUG_PRINT(3, "Write token received from nibe\n");
      int packetSize = udp4writeCmnds.parsePacket();
      if (packetSize) {
        len = udp4writeCmnds.read(data, packetSize);
        DEBUG_PRINTDATA(2, "Send write command to nibe, len=%d, ", len);
        DEBUG_PRINT(1, " data in: ");
        DEBUG_PRINTARRAY(1, data, len)
        DEBUG_PRINT(1, "\n");
#ifdef TRANSPORT_ETH_ENC28J60
        udp4writeCmnds.flush();
        udp4writeCmnds.stop();
