How do I get amount of queued data for UDP socket?

后端 未结 2 835
鱼传尺愫
鱼传尺愫 2020-12-03 03:09

To see how well I\'m doing in processing incoming data, I\'d like to measure the queue length at my TCP and UDP sockets.

I know that I can get the queue size via

2条回答
  •  春和景丽
    2020-12-03 04:13

    FWIW, I did some experiments to map out the behavior of FIONREAD on different platforms.

    Platforms where FIONREAD returns all the data pending in a SOCK_DGRAM socket:

    Mac OS X, NetBSD, FreeBSD, Solaris, HP-UX, AIX, Windows

    Platforms where FIONREAD returns only the bytes for the first pending datagram:

    Linux

    It might also be worth noting that some implementations include headers or other overhead bytes in the count, while others only count the payload bytes. Linux appears to return the payload size, not including IP headers.

提交回复
热议问题