如何使用C+中带有SFML的http请求从node.js服务器获取数据+;? >,我目前在C++中的代码是: #include <SFML/Network.hpp> #include <iostream> int main() { // prepare the request sf::Http::Request request("/", sf::Http::Request::Get); // send the request sf::Http http("http://localhost:3000/"); sf::Http::Response response = http.sendRequest(request); // check the status std::cout << response.getStatus(); return 0; } #包括 #包括 int main() { //准备请求 sf::Http::Request请求(“/”,sf::Http::Request::Get); //发送请求 sf::Http(“http://localhost:3000/"); sf::Http::Response-Response=Http.sendRequest(请求); //检查状态 std::cout

如何使用C+中带有SFML的http请求从node.js服务器获取数据+;? >,我目前在C++中的代码是: #include <SFML/Network.hpp> #include <iostream> int main() { // prepare the request sf::Http::Request request("/", sf::Http::Request::Get); // send the request sf::Http http("http://localhost:3000/"); sf::Http::Response response = http.sendRequest(request); // check the status std::cout << response.getStatus(); return 0; } #包括 #包括 int main() { //准备请求 sf::Http::Request请求(“/”,sf::Http::Request::Get); //发送请求 sf::Http(“http://localhost:3000/"); sf::Http::Response-Response=Http.sendRequest(请求); //检查状态 std::cout,c++,node.js,http,server,sfml,C++,Node.js,Http,Server,Sfml,我认为您使用的sf::Http构造函数是错误的 构造函数调用不分析端口号的函数。您需要显式传递端口号,如下所示: sf::Http http("http://localhost", 3000); 我认为您使用的sf::Http构造函数是错误的 构造函数调用不分析端口号的函数。您需要显式传递端口号,如下所示: sf::Http http("http://localhost", 3000); 天哪,我不知道我是怎么错过的。它现在似乎在工作,非常感谢!天哪,我不知道我是怎么错过的。它现在似乎在工作

我认为您使用的
sf::Http
构造函数是错误的

构造函数调用不分析端口号的函数。您需要显式传递端口号,如下所示:

sf::Http http("http://localhost", 3000);

我认为您使用的
sf::Http
构造函数是错误的

构造函数调用不分析端口号的函数。您需要显式传递端口号,如下所示:

sf::Http http("http://localhost", 3000);

天哪,我不知道我是怎么错过的。它现在似乎在工作,非常感谢!天哪,我不知道我是怎么错过的。它现在似乎在工作,非常感谢!