Fixed non-blocking issue. It was because the server was terminating.