You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
QxHttpServer module is used as http server and QNetworkAccessManager is used as http client. The http client sends a post message ,but the http server cannot receive it.
http server code:
int main(int argc, char* argv[])
{
QCoreApplication app(argc, argv);
qx::service::QxConnect* serverSettings = qx::service::QxConnect::getSingleton();
serverSettings->setIp("127.0.0.1");
serverSettings->setPort(6000);
serverSettings->setKeepAlive(5000);
serverSettings->setThreadCount(50);
QNetworkRequest request;
QNetworkRequest::KnownHeaders header = QNetworkRequest::ContentTypeHeader;
QVariant value = "application/json";
request.setHeader(header, value);
request.setUrl(QUrl("http://127.0.0.1:6000"));
QByteArray data = "Hello world!";
manager->post(request, data);
I can't receive post messages from http clients in lumbda at httpServer.dispatch.I am using Qt's QNetworkAccessManager to post messages in my application. How can I solve this problem? Looking forward to your reply!
The text was updated successfully, but these errors were encountered:
Yes, it's my fault. I should study the demo well. Your example project works well and it is a great example. I think I need to find a way to make it work QNetworkAccessManager with well. Sincere thanks again!
Hello!
QxHttpServer module is used as http server and QNetworkAccessManager is used as http client. The http client sends a post message ,but the http server cannot receive it.
http server code:
int main(int argc, char* argv[])
{
QCoreApplication app(argc, argv);
qx::service::QxConnect* serverSettings = qx::service::QxConnect::getSingleton();
serverSettings->setIp("127.0.0.1");
serverSettings->setPort(6000);
serverSettings->setKeepAlive(5000);
serverSettings->setThreadCount(50);
qx::QxHttpServer httpServer;
httpServer.dispatch("POST", "application/json", [](qx::QxHttpRequest& request, qx::QxHttpResponse& response) {
response.data() = "Hello World !";
});
httpServer.dispatch("POST", "", [](qx::QxHttpRequest& request, qx::QxHttpResponse& response) {
response.data() = "Hello World !";
});
httpServer.startServer();
return app.exec();
}
http client code:
QNetworkAccessManager* manager = new QNetworkAccessManager();
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(finished(QNetworkReply*)));
QNetworkRequest request;
QNetworkRequest::KnownHeaders header = QNetworkRequest::ContentTypeHeader;
QVariant value = "application/json";
request.setHeader(header, value);
request.setUrl(QUrl("http://127.0.0.1:6000"));
QByteArray data = "Hello world!";
manager->post(request, data);
I can't receive post messages from http clients in lumbda at httpServer.dispatch.I am using Qt's QNetworkAccessManager to post messages in my application. How can I solve this problem? Looking forward to your reply!
The text was updated successfully, but these errors were encountered: