How are you solving the dynamic IP issue?
And as to the heating, the only code that executes in the loop usually is:
Client client = server.available();
Is that right? If that is happening thousands of times a second I don't know if it would heat up the chip or not. You could add:
Client client = server.available();
delay(100); // Check 10 times a second
That might help or do nothing. Can't hurt to test it! Oh, and a heat sink might be an obvious solution too.
The rest of the code only runs intermittently when data is being moved about as far as I can see, so that can't cause excessive heating (that you might be able to avoid).