How does zero copy work when receiving data from socket and pushing it to a file?
Alan Bateman
Alan.Bateman at oracle.com
Tue Oct 20 14:37:12 UTC 2020
On 20/10/2020 14:16, kant kodali wrote:
> :
>
> so seems to me that
>
> reading data from local file -> do some verification on data -> send
> it to socket (Zero copy possible)
>
> reading data from socket -> do some verification on data -> send it to
> local file (Zero copy not possible)
>
> is that correct?
>
Yes, that's a fair summary. The transferTo method is implemented to use
sendfile if possible. Nothing equivalent in the transferFrom
implementation so socket -> file will always go through intermediate
buffers.
-Alan.
More information about the nio-dev
mailing list