Satya Kumar
Satya Kumar

Reputation: 177

how to zero copy in a Qt C++ programme?

I have to implement zero copy method in a program in Qt C++,I read about it and got transferto() method.as described below: public void transferTo(long position, long count, WritableByteChannel target);

but i can't understand how it works.It is written that Internally, it depends on the underlying operating system's support for zero copy. So I tried to write a function but i didn't get the meaning of "position" and "channel" here.

Can anyone help me?

Upvotes: 1

Views: 584

Answers (1)

Pavel Strakhov
Pavel Strakhov

Reputation: 40512

There is no cross-platform way to do zero copy in C++, and there is no zero-copy API in Qt. You can implement it for your target OS using provided API:

Linux supports zero copy through system calls such as sys/socket.h's sendfile, sendfile64, and splice. Windows supports zero copy through the TransmitFile API.

Source

Upvotes: 4

Related Questions