Is there a way to block on a socket send() until we get the ack for that packet?

后端 未结 7 1354
盖世英雄少女心
盖世英雄少女心 2020-12-31 12:47

Or do I have to implement it at the application level?

7条回答
  •  萌比男神i
    2020-12-31 13:43

    If you use setsockopt() to lower SO_SNDBUF to a value only large enough to send one packet, then the next send() on that socket should block until the previous packet is acknowledged. However, according to tcp(7), the socket buffer size must be set prior to listen()/connect().

提交回复
热议问题