加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

我为什么要使用或不使用MSG_CONFIRM?

发布时间:2020-12-16 09:44:57 所属栏目:百科 来源:网络整理
导读:我熟悉BSD套接字,然后翻阅sendto的手册页,我碰到了MSG_CONFIRM标志,这对我来说是非常神秘的. 描述说: Tell the link layer that forward progress happened: you got a successful reply from the other side. If the link layer doesn’t get this it will
我熟悉BSD套接字,然后翻阅sendto的手册页,我碰到了MSG_CONFIRM标志,这对我来说是非常神秘的.

描述说:

Tell the link layer that forward progress happened: you got a
successful reply from the other side. If the link layer doesn’t get
this it will regularly reprobe the neighbor (e.g.,via a unicast ARP).
Only valid on SOCK_DGRAM and SOCK_RAW sockets and currently
implemented only for IPv4 and IPv6.

在快速查看arp的手册页之后,我明白标记某些内容MSG_CONFIRM会阻止ARP映射MAC地址?远程计算机的IP地址被视为过时.

现在我感到困惑,因为我看不出任何我不应该提出的理由,因此,为什么他们不直接在图书馆强制执行.为什么应用层应该处理在链路层发生的任何事情.

所以我错过了什么?我什么时候应该设置它,还是不设置它?

解决方法

如果您发送的数据报是对刚刚从同一对等方收到的数据报的直接响应,则只应设置该标志.

如果您发送初始请求,或发送数据报以响应某些其他事件(如用户输入或超时),则不应设置MSG_CONFIRM标志.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读