From 13e889a82c12fbbeb30e458870a688f029c51953 Mon Sep 17 00:00:00 2001 From: Neil McKechnie Date: Thu, 11 Nov 2021 13:33:27 +0000 Subject: [PATCH] Avoid sending ethernet responses one character at a time. Send commands --- EthernetInterface.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/EthernetInterface.cpp b/EthernetInterface.cpp index c6f80b3..2f38c84 100644 --- a/EthernetInterface.cpp +++ b/EthernetInterface.cpp @@ -178,8 +178,14 @@ void EthernetInterface::loop() int socketOut=outboundRing->read(); if (socketOut>=0) { int count=outboundRing->count(); + uint16_t index = 0; if (Diag::ETHERNET) DIAG(F("Ethernet reply socket=%d, count=:%d"), socketOut,count); - for(;count>0;count--) clients[socketOut].write(outboundRing->read()); + while (count > 0) { + index = 0; + for(;count>0 && index < MAX_ETH_BUFFER;count--) buffer[index++] = outboundRing->read(); + clients[socketOut].write(buffer, index); + } + //for(;count>0;count--) clients[socketOut].write(outboundRing->read()); clients[socketOut].flush(); //maybe } }