如何findlinux的socket缓冲区大小

什么是Linux的默认套接字缓冲区大小? 有什么命令可以看到吗?

如果你想在terminal看到你的缓冲区大小,你可以看看:

  • /proc/sys/net/ipv4/tcp_rmem (供读取)
  • /proc/sys/net/ipv4/tcp_wmem (用于写入)

它们包含三个数字,分别是最小值,默认值和最大内存大小值(以字节为单位)。

为了在c / c ++程序中获得缓冲区大小,以下是stream程

 int n; unsigned int m = sizeof(n); int fdsocket; fdsocket = socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP); // example getsockopt(fdsocket,SOL_SOCKET,SO_RCVBUF,(void *)&n, &m); // now the variable n will have the socket size 

primefaces大小为4096字节,最大大小为65536字节。 Sendfile使用16个4096字节大小的pipe道。 cmd:ioctl(fd,FIONREAD和buff_size)。