refactor tcp send/recv API