Bug fix & Refactor

1. Move timeout check from `main.py` to `server.receive` and `server.send`.
2. Correct the typo from `recieve` to `receive`.
3. Use a different method to make sure connection timeout check is correct.
4. Re-format the log.