improve packet recv and handle