How to increase net.core.rmem_max value from c cod

2019-03-01 17:04发布

I tried to increase the value SO_RCVBUF by getsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, &rcvBufferSize, &sockOptSize) but I am not able to increase it more than rmem_max value.

So please tell me how can I increase it by C Code. I don't want to increase it by command :

$ sysctl -w net.core.rmem_max=value

标签: fedora c
2条回答
相关推荐>>
2楼-- · 2019-03-01 17:13

In Linux kernels 2.6.14 and above we have SO_RCVBUFFORCE which can be used to override the rmem_max limit. However this needs CAP_NET_ADMIN to be set.

Check https://linux.die.net/man/7/socket.

查看更多
Explosion°爆炸
3楼-- · 2019-03-01 17:18

So please tell me how can I increase it by C Code

If the process has root rights, then let it printf the desired number to

/proc/sys/net/core/rmem_max
查看更多
登录 后发表回答