gpt4 book ai didi

go - func (*UDPConn) ReadMsgUDP 中的 oob 是什么?

转载 作者:IT王子 更新时间:2023-10-29 02:23:12 24 4
gpt4 key购买 nike

This link TCP中有关于OOB的信息。

With out-of-band data we want the byte-stream service layer on the sending side to send this data before any other data that it has buffered. Similarly we want the receiving end to pass this data to its user process ahead of any data that it might have buffered.

但是 UDP 呢?

在golang中,ReadMsgUDP函数需要一个oob byte slice 。

func (c *UDPConn) ReadMsgUDP(b, oob []byte) (n, oobn, flags int, addr *UDPAddr, err error)

oob 有什么用?开源代码中是否有任何用例?或者我应该使用 PacketConn 而不是 UDPConn

最佳答案

好吧,正如我所尝试的,当您希望其他信息(例如 pktinfo)通过设置 syscall.setsockoption 获取本地地址时,您将需要它。当您不想要面向连接的 UDP 时,就会发生这种情况。

关于go - func (*UDPConn) ReadMsgUDP 中的 oob 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37268653/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com