RE: zero copy for relay server
From: Eric Dumazet <hidden>
Date: 2011-03-28 18:34:22
Le lundi 28 mars 2011 à 23:48 +0530, Viral Mehta a écrit :
Still, these are two system calls.
Yes. Is it a problem ? What kind ?
In addition to this, many things to handle, 1. if the incoming_fd is blocking, then it will block till 64K data read. Why so ?
I dont think so. Try it, like read() of recv().
2. I believe underlying PIPE that we are using will also have some size limit
(like in user space 4K or 64K, not sure)What kind of socket is able to deliver more than 64K frames ?
So, all in all Why cant we have just one system call which really transfers "length" bytes of data form one socket to another ? Recv "length" bytes of data from socket A and send to socket B. I wanted to understand if there are any limitations or concerns that we still do not have any such system call .... ?
The answer is : Once you try to implement this, you'll discover it'll be splice() based, using pipe as a buffer between the sockets. sendfile() is based on top of splice(), but it's faster to use splice().