How to Not Listen to Broadcast in TCP Server

I set my TCP Server in the SOCK_LISTEN (S0_SR = 0x14) all the time, so it can receive and immediately reply to a request from a peer every 100ms. I am polling S0_SR every 10ms, and everything works fine. However, the broadcast “Who has…” crew up my app …???

After receiving a broadcast message, my S0_SR was changed to 0x01, 0x02, and 0x03 with S0_IR interrupt (CON, RECV, SEND_OK). After that, my code puts it back to the SOCK_LISTEN mode again. During the broadcast, I lost several requests from my peer, and finally the peer sent a DISCONN request.

Is there anyway to avoid the response to the broadcast or any work around this, please help.

Thank you very much.

“Who has” is an ARP packet working at level 2. TCP/IP is at level 4. ARP packets must not affect TCP communication.

But it will affect overall communication if you use W5500 in MAC RAW mode.

I see your other post asking about these states. I never seen them, but they may exist and be transitional if you poll device very quickly.

But this clearly means there was a communication in place. Please share Wireshark log.