When does a UDP sendto() block?

前端 未结 2 1479
孤城傲影
孤城傲影 2020-12-13 00:31

While using the default (blocking) behavior on an UDP socket, in which case will a call to sendto() block? I\'m interested essentially in the Linux behavior.

For TCP

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-13 01:21

    This may be because your operating system is attempting to perform an ARP request in order to get the hardware address of the remote host.

    Basically whenever a packet goes out, the header requires the IP address of the remote host and the MAC address of the remote host. 192.168.1.34 and AB:32:24:64:F3:21.

    Your "block" behavior could be that ARP is working.

    I've heard in older versions of Windows (2k I think), that the 1st packet would sometimes get discarded if the request is taking too long and you're sending out too much data. A service pack probably fixed that since then.

提交回复
热议问题