当前位置: 首页>>代码示例>>C++>>正文


C++ HttpServer::listen方法代码示例

本文整理汇总了C++中HttpServer::listen方法的典型用法代码示例。如果您正苦于以下问题:C++ HttpServer::listen方法的具体用法?C++ HttpServer::listen怎么用?C++ HttpServer::listen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HttpServer的用法示例。


在下文中一共展示了HttpServer::listen方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: startWebServer

void startWebServer()
{
	server.listen(80);
	server.addPath("/", onIndex);
	server.addPath("/lcd", onLcd);
	server.addPath("/volume", onVolume);
	server.addPath("/mute", onMute);
	server.addPath("/source", onSource);
	server.addPath("/state", onState);
	server.addPath("/power", onPower);
	server.addPath("/tune", onTune);
	server.addPath("/mixing", onMixing);
	server.addPath("/enhance", onEnhance);
	
		// Web Sockets configuration
	server.enableWebSockets(true);
	server.setWebSocketConnectionHandler(wsConnected);
	server.setWebSocketMessageHandler(wsMessageReceived);
	server.setWebSocketBinaryHandler(wsBinaryReceived);
	server.setWebSocketDisconnectionHandler(wsDisconnected);

	
	server.setDefaultHandler(onFile);

	Serial.println("\r\n=== WEB SERVER STARTED ===");
	Serial.println(WifiStation.getIP());
    lcd.clear();
    lcd.setCursor(1,1);
	lcd.print(WifiStation.getIP());
}
开发者ID:avtehnik,项目名称:esp8266-music-box,代码行数:30,代码来源:application.cpp

示例2: StartServers

void StartServers()
{
	server.listen(80);
	server.addPath("/", onIndex);
	server.setDefaultHandler(onFile);

	// Web Sockets configuration
	server.enableWebSockets(true);
	server.commandProcessing(true,"command");

	server.setWebSocketConnectionHandler(wsConnected);
	server.setWebSocketMessageHandler(wsMessageReceived);
	server.setWebSocketBinaryHandler(wsBinaryReceived);
	server.setWebSocketDisconnectionHandler(wsDisconnected);

	Serial.println("\r\n=== WEB SERVER STARTED ===");
	Serial.println(WifiStation.getIP());
	Serial.println("==============================\r\n");

	// Start FTP server
	ftp.listen(21);
	ftp.addUser("me", "123"); // FTP account

	Serial.println("\r\n=== FTP SERVER STARTED ===");
	Serial.println("==============================\r\n");

	telnet.listen(23);
	telnet.enableDebug(true);

	Serial.println("\r\n=== TelnetServer SERVER STARTED ===");
	Serial.println("==============================\r\n");
}
开发者ID:BorntraegerMarc,项目名称:Sming,代码行数:32,代码来源:application.cpp

示例3: startWebServer

// Will be called when system initialization was completed
void startWebServer()
{
	Serial.println("starting web-server...");
	server.listen(80);
	server.addPath("/ajax/get-networks", onAjaxNetworkList);
	server.addPath("/ajax/connect", onAjaxConnect);
	server.addPath("/ajax/get-ip", onAjaxGetIP);
	server.addPath("/ajax/disable-ap", onAjaxDisableAP);

}
开发者ID:ti8m,项目名称:IoTmeetsBusiness,代码行数:11,代码来源:application.cpp

示例4: startWebServer

void startWebServer()
{
	server.listen(80);
	server.addPath("/", onIndex);
	server.addPath("/hello", onHello);
	server.setDefaultHandler(onFile);

	Serial.println("\r\n=== WEB SERVER STARTED ===");
	Serial.println(WifiStation.getIP());
	Serial.println("==============================\r\n");
}
开发者ID:0xPIT,项目名称:Sming,代码行数:11,代码来源:application.cpp

示例5: startWebServer

void startWebServer()
{
	server.listen(80);
	server.addPath("/", onIndex);
	server.addPath("/ipconfig", onIpConfig);
	server.addPath("/mqttconfig", onMqttConfig);
	server.addPath("/ota", onOtaConfig);
	server.addPath("/ajax/get-networks", onAjaxNetworkList);
	server.addPath("/ajax/run-ota", onAjaxRunOta);
	server.addPath("/ajax/connect", onAjaxConnect);
	server.setDefaultHandler(onFile);
}
开发者ID:linlun,项目名称:SW-ESP8266_Lunch,代码行数:12,代码来源:application.cpp

示例6: startWebServer

void startWebServer()
{
	server.listen(80);
	server.addPath("/", onIndex);
	server.addPath("/ajax/input", onAjaxInput);
	server.addPath("/ajax/frequency", onAjaxFrequency);
	server.setDefaultHandler(onFile);

	Serial.println("\r\n=== WEB SERVER STARTED ===");
	Serial.println(WifiStation.getIP());
	Serial.println("==============================\r\n");
}
开发者ID:BorntraegerMarc,项目名称:Sming,代码行数:12,代码来源:application.cpp

示例7: startWebServer

void ICACHE_FLASH_ATTR startWebServer()
{
	server.listen(80);
	server.addPath("/", onIndex);
	server.addPath("/test", onTest);
	server.addPath("/ota", onOta);
	server.addPath("/ipconfig", onIpConfig);
	server.addPath("/system", onSystem);
	server.addPath("/ajax/get-networks", onAjaxNetworkList);
	server.addPath("/ajax/connect", onAjaxConnect);
	server.setDefaultHandler(onFile);
}
开发者ID:gernoteger,项目名称:DobbyESP,代码行数:12,代码来源:application.cpp

示例8: main

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    QCoreApplication app(argc, argv);
    QCoreApplication::setApplicationName("evnav-cli");
    QCoreApplication::setApplicationVersion("0.1");

    QCommandLineParser parser;
    parser.setApplicationDescription("electric vehicule trip planner");
    parser.addHelpOption();
    parser.addVersionOption();
    parser.addPositionalArgument("osrm", "path to osrm file");
    parser.addPositionalArgument("charger", "path to json charger file");

    parser.process(app);
    const QStringList args = parser.positionalArguments();

    if (args.size() < 2) {
        qDebug() << "missing arguments";
        parser.showHelp(1);
    }

    qDebug() << "loading street data...";
    Evnav evnav(args.at(0));

    qDebug() << "loading chargers...";
    ChargerProvider provider;
    provider.loadJson(args.at(1));
    ChargerProvider dcfc = provider.filter(provider.fastChargerFilter());
    qDebug() << "fast chargers found:" << dcfc.size();

    evnav.setChargerProvider(&dcfc);
    evnav.initGraph();

    HttpServer httpd;
    EvnavServer handler;
    handler.setEngine(&evnav);

    HttpServerRequestRouter router {
        { QRegularExpression{"^/route/v1/evnav/.*"}, handler },
        { QRegularExpression{",*"}, NotFoundHandler::handler() },
    };

    QObject::connect(&httpd, &HttpServer::requestReady,
        &router, &HttpServerRequestRouter::handleRequest);

    httpd.listen(QHostAddress::Any, 8080);

    return a.exec();
}
开发者ID:hexa00,项目名称:evnav,代码行数:51,代码来源:main.cpp

示例9: web_run

void web_run() {
	WifiStation.enable(true);
	server.listen(80);
	server.addPath("/driver/pos", web_cb_driver_pos);
	server.addPath("/driver/setpos", web_cb_driver_setpos);
	server.addPath("/driver/forward", web_cb_driver_forward);
	server.addPath("/driver/backward", web_cb_driver_backward);
	server.addPath("/driver/stop", web_cb_driver_stop);
	server.addPath("/scan", web_cb_start_scan);
	server.addPath("/scanStatus", web_cb_scan_status);
	server.addPath("/connect", web_cb_connect);
	server.setDefaultHandler(onFile);
	startFTP();
}
开发者ID:Bravo13,项目名称:esp_hello_world,代码行数:14,代码来源:utils.cpp

示例10: main

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    HttpServer server;

    QObject::connect(&server, &HttpServer::requestReady,
                     [](HttpServerRequest &, HttpServerResponse &res){
                         res.writeHead(HttpResponseStatus::OK);
                         res.end("Hello World");
                     });

    server.listen(QHostAddress::Any, 8080);

    return a.exec();
}
开发者ID:gonboy,项目名称:tufao-qtcreatorplugin,代码行数:16,代码来源:main.cpp

示例11: startWebServer

void startWebServer()
{
	server.listen(80);
	server.addPath("/", onIndex);
	server.setDefaultHandler(onFile);

	// Web Sockets configuration
	server.enableWebSockets(true);
	server.setWebSocketConnectionHandler(wsConnected);
	server.setWebSocketMessageHandler(wsMessageReceived);
	server.setWebSocketBinaryHandler(wsBinaryReceived);
	server.setWebSocketDisconnectionHandler(wsDisconnected);

	Serial.println("\r\n=== WEB SERVER STARTED ===");
	Serial.println(WifiStation.getIP());
	Serial.println("==============================\r\n");
}
开发者ID:BorntraegerMarc,项目名称:Sming,代码行数:17,代码来源:application.cpp

示例12: connectFail

void connectFail()
{
	debugf("Connection failed");

	WifiAccessPoint.config("Sprinkler Configuration " + WifiAccessPoint.getMAC().substring(WifiAccessPoint.getMAC().length() - 4), "", AUTH_OPEN);
	WifiAccessPoint.enable(true);

	WifiStation.enable(false);
	WifiStation.startScan(networkScanCompleted);
	WifiStation.waitConnection(connectOk); // Wait connection

	server.listen(80);
	server.addPath("/", onIndex);
	server.addPath("/ipconfig", onIpConfig);
	server.addPath("/ajax/get-networks", onAjaxNetworkList);
	server.addPath("/ajax/connect", onAjaxConnect);
	server.setDefaultHandler(onFile);
}
开发者ID:bhasden,项目名称:yoovea,代码行数:18,代码来源:Wifi.cpp

示例13: StartServers

/*
 * start http and telnet server
 * telnet can be used to configure cammera settings
 * unsing ArdCammCommand handler
 */
void StartServers()
{
	server.listen(80);
	server.addPath("/", onIndex);
	server.addPath("/cam/set", onCamSetup);
	server.addPath("/cam/capture", onCapture);
//	server.addPath("/stream", onStream);
	server.addPath("/favicon.ico", onFavicon);
	server.setDefaultHandler(onFile);

	Serial.println("\r\n=== WEB SERVER STARTED ===");
	Serial.println(WifiStation.getIP());
	Serial.println("==============================\r\n");


	telnet.listen(23);
	telnet.enableDebug(true);

	Serial.println("\r\n=== TelnetServer SERVER STARTED ===");
	Serial.println("==============================\r\n");
}
开发者ID:blinkingnoise,项目名称:Sming,代码行数:26,代码来源:application.cpp

示例14: startWebServer

void startWebServer()
{
        server.listen(80);
        server.addPath("/", onIndex);
        server.addPath("/index.html", onIndex);
}
开发者ID:gustavobreunig,项目名称:Sming_IRemoteSound,代码行数:6,代码来源:application.cpp


注:本文中的HttpServer::listen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。