1. Use Sleep() to solve the problem that socket is closed before buffer flush
2. Add handle_error() in both pk and logger server