UDP Server Socket Buffer Overflow

前端 未结 3 1777
南旧
南旧 2021-02-09 17:20

I am writing a C++ application on Linux. My application has a UDP server which sends data to clients on some events. The UDP server also receives some feedback/acknowledgement

3条回答
  •  借酒劲吻你
    2021-02-09 17:44

    You can see the maximum allowed buffer size:

    sysctl net.core.rmem_max
    

    You can set the maximum buffer size you can use by:

    sysctl -w net.core.rmem_max=8388608
    

    You can also set the buffer size at run-time (not exceeding the max above) by using setsockopt and changing SO_RCVBUF. You can see the buffer level by looking at /proc/net/udp.

    The buffer is used to store the UDP header and application data, rest belong to lower levels.

提交回复
热议问题