I am using arduino with ethercard and an ENC28j60 chip. In this case arduino works as a TCP server. One of the messages I receive contains the data SETtck: and 4 bytes. In this case I have to send back 4 bytes in the response message:
Part of my code contains the following:
const char Period[4]={XVC_PERIOD&0xFF,
(XVC_PERIOD&0xFF00)>>8,
(XVC_PERIOD&0xFF0000) >> 16,
(XVC_PERIOD&0xFF000000)>> 24};
if (strstr((char *)Ethernet::buffer + pos, "settck:") ){
Serial.println("Recibido comando settck:");
pos +=7;
BufferFiller bfill = ether.tcpOffset();
bfill.emit_raw(
Period,sizeof(Period)
);
ether.httpServerReply(bfill.position());
Analyzing with wireshark you can see that 2 packets are sent back, one from an ACK without Data and the other from ACK + Data (RETRANSMISION in wireshark). The valid one would be the second:
How can I prevent the ACK packet from being sent without data.
I also tried the httpServerReply_with_flags and the same thing happens, it always sends an invalid ACK packet.
Thank you.
