I am trying to implement zero copy approach in my client progrm where I will recieve a large amount of data from server.Here is my client program: //Client.h
#ifndef CLIENT_H
#define CLIENT_H
#include <QtNetwork/QTcpSocket>
#include <QObject>
#include <QString>
class Client: public QObject
{
Q_OBJECT
public:
Client(QObject* parent = 0);
~Client();
void start(QString address, quint16 port);
public slots:
void startTransfer();
private:
QTcpSocket client;
};
#endif // CLIENT_H
//Client.cpp
#include "client.h"
#include <QtNetwork/QHostAddress>
Client::Client(QObject* parent): QObject(parent)
{
connect(&client, SIGNAL(connected()),
this, SLOT(startTransfer()));
}
Client::~Client()
{
client.close();
}
void Client::start(QString address, quint16 port)
{
QHostAddress addr(address);
client.connectToHost(addr, port);
}
void Client::startTransfer()
{
virtual QByteArray client::readanydata();
}
readanydata() should be replaced by any other API,as read() and readall() use memory copy they are not suitable for zero copy approach.client is instance of QTcpsocket.what should I use here.any suggestion,as I am not getting any API or should I write my own function.If I have to write my own function how will it call transmitfile() api.