Server response handling code.