Avoiding TIME_WAIT

前端 未结 3 698
一个人的身影
一个人的身影 2020-12-19 06:47

I\'m trying to avoid TIME_WAIT in a client. I connect and then set O_NONBLOCK and SO_REUSEADDR. I call read until it returns 0. When read returns 0, the errno is also 0.

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-19 07:16

    Later on the same page they mention SO_REUSEADDR. That's what you need. You definitely want to close the read file descriptor when it returns zero.

提交回复
热议问题