@JonB
sorry for late reply. you suggestion worked well.
i followed https://wiki.qt.io/WIP-How_to_create_a_simple_chat_application and modified my code according to that. now at sender side looks like this
QJsonDocument doc1;
QFile j("/home/first.JSON");
if(j.exists())
{
if(j.open(QIODevice:: ReadOnly| QIODevice::Text))
{
jstr=j.readAll();
doc1= QJsonDocument::fromJson(jstr.toUtf8());
}
j.close();
QDataStream clientStream(socket);
clientStream.setVersion(QDataStream::Qt_5_7);
// Create the JSON we want to send
QJsonObject message;
message[QStringLiteral("type")] = QStringLiteral("message");
clientStream << QJsonDocument(doc1).toJson();
}
}
else {
ui->l_err->show();
ui->l_err->setText("Connection refused. Please check server.");
}
and used server application from the link above at receiver end.
this works well. I have tested this with JSON file having 3000 object. Will this work for 50,000 samples and more possibly 1500000 objects?