Linux – Size of data that can be written to / read from sockets

fileslinuxsocket

I was wondering if there is an easy way to find the maximum size that is supported by Linux sockets? (Is this configurable? If so where?)

For example, most of the socket examples found on the web send "Hello Socket" or some such other small string, however if I put the whole of War And Peace into the socket, when does it break?

As everything is a file, is it the maximum file size? How is it coordinated when sockets connect different file systems?

I'm most interested in stream sockets.

Best Answer

net.core.rmem_max and net.core.wmem_max are your thing. You can examine their values with

# sysctl net.core.rmem_max

and set them with

# sysctl -w net.core.rmem_max=8388608

These are the socket buffer sizes, when receiving and sending, respectively. They have default values, too, - rmem_default and wmem_default.

Related Question