bug fix and add step limit

1. close socket in `network.cpp`
2. import `socket` in `main.py`
3. `try-catch` block for `socket.send` in `main.py`
4. `try-catch` block in case of `message` is empty in `chess.py`