Problem: UDP Wraped with If Statement

That MUX shield uses D4, and so does the SD card. That will cause SPI bus collisions between the SD card and the W5100. Remove the SD card.