I have a following doubt related to socket rmem_max and wmem_max.
Below is the output taken from my linux machine.
cat /proc/sys/net/core/rmem_max
212992
cat /proc/sys/net/core/rmem_default
212992
cat /proc/sys/net/core/wmem_max
212992
cat /proc/sys/net/core/wmem_default
212992.
so i thought of verifying whether the above values are wroking as expected or not. I have created two process(client socket and server socket) both are LOCAL unix sockets(AF_UNIX). I have made the server program to sleep for indefinite period of time before recv() call has been executed.
Client socket is sending 1024 bytes to server socket in a continuos while loop.
But i dont get a error even after sending more than 212992 bytes. My understanding is that since server is sleeping indefinitely it wont able to get the data from kernel socket buffer at the same time client is keep on pushing the data to the server. So all these data will be stored in the kernel buffer. since send() has the limitation of 212992 bytes(wmem_max) , send() client call should fail after enough kernel buffer has been used.
But this is not happening, i could see more than 113271663 number of ietrations are ongoing without any problem and send() call is not at all failing.
What is the value of wmem_default and rmem_default denotes?
Can someone please clarify what is the maximum socket buffers available in linux for send() and recv() and how this huge data is stored in linux kernel socket buffers wihtout any failure?
What I have tried:
Sent 1024 bytes successfully (i=139453022)
Sent 1024 bytes successfully (i=139453023)
Sent 1024 bytes successfully (i=139453024)
Sent 1024 bytes successfully (i=139453025)
Sent 1024 bytes successfully (i=139453026)
Sent 1024 bytes successfully (i=139453027)
...
139453027 number of 1024 chunks has been sent via send() kernel call without any failure.
//below is the server program sleeping indefinitely
for(;;) {
int completed, n, num;
printf("Waiting for a connection...\n");
n = sizeof(remote);
if ((sock_serv = accept(sock, (struct sockaddr *)&remote, &n)) == -1) {
perror("accept call failed");
exit(1);
}
printf("server socket Connected.\n");
sleep(100000); // indefinite sleep
completed = 0;
do {
num = recv(sock_serv, str, 1024, 0);
;
;
;
}