The socket buffer is owned by the kernel, you will never be allowed to write into kernel space. Never, ever. Too much of a security risk.
The only way to do zero-copy is to use vmsplice(2)
, but it is not officially supported for sockets and is not recommended to use for anything other then pipes.
If you do decide to use vmsplice
, keep in mind that you must then commit your data in chunks of pages sysconf(_SC_PAGESIZE)
. Also it is a Linux only syscall and not portable.