How to find the socket buffer size of linux

后端 未结 4 581
情歌与酒
情歌与酒 2020-11-28 22:00

What\'s the default socket buffer size of linux? Is there any command to see it?

4条回答
  •  不知归路
    2020-11-28 22:33

    For getting the buffer size in c/c++ program the following is the flow

    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
    

提交回复
热议问题