I am trying to figure out / adjust the size of network buffers:
import socket sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) sock.getsockopt(socket.SOL_SOCKET,socket.SO_RCVBUF) 212992
What it is? ~ 0.2 MBytes ..!?
However, if I look for the buffer size elsewhere, that is, on the command line:
sampsa@sampsa-xps13 :~/python/sockets$ cat /proc/sys/net/ipv4/tcp_wmem 4096 16384 4194304
.. I get 4096 bytes.
Try setting the size of the buffer, and then check its value:
sock.setsockopt(socket.SOL_SOCKET,socket.SO_RCVBUF,1024) sock.getsockopt(socket.SOL_SOCKET,socket.SO_RCVBUF) 2304
What's happening?
Substituting SOL_SOCKET with SOL_UDP gives "Protocol Unavailable"
How to set up max. UDP packet size .. or even find it?
source share