bool LoopbackDeviceLink::sendPackage(NetworkPackage& input) { NetworkPackage output(QString::null); NetworkPackage::unserialize(input.serialize(), &output); //LoopbackDeviceLink does not need deviceTransferInfo if (input.hasPayload()) { bool b = input.payload()->open(QIODevice::ReadOnly); Q_ASSERT(b); output.setPayload(input.payload(), input.payloadSize()); } Q_EMIT receivedPackage(output); return true; }
bool LanDeviceLink::sendPackage(NetworkPackage& np) { if (np.hasPayload()) { UploadJob* job = new UploadJob(np.payload()); job->start(); np.setPayloadTransferInfo(job->getTransferInfo()); } int written = mSocketLineReader->write(np.serialize()); //TODO: Actually detect if a package is received or not, now we keep TCP //"ESTABLISHED" connections that look legit (return true when we use them), //but that are actually broken return (written != -1); }