#include #include #include void httpd_task(void *pvParameters) { struct netconn *client = NULL; struct netconn *nc = netconn_new(NETCONN_TCP); if (nc == NULL) { printf("Failed to allocate socket\n"); vTaskDelete(NULL); } netconn_bind(nc, IP_ADDR_ANY, 80); netconn_listen(nc); while (1) { err_t err = netconn_accept(nc, &client); if (err == ERR_OK) { struct netbuf *nb; if ((err = netconn_recv(client, &nb)) == ERR_OK) { struct sdk_station_config config; sdk_wifi_station_get_config(&config); const char * buf = "\ \ \ urn:Belkin:device:controllee:1\ hello\ Belkin International Inc.\ Emulated Socket\ 3.1415\ uuid:Socket-1_0-38323636-4558-4dda-9188-cda0e6cc3dc0\ 221517K0101769\ 0\ \ \ urn:Belkin:service:basicevent:1\ urn:Belkin:serviceId:basicevent1\ /upnp/control/basicevent1\ /upnp/event/basicevent1\ /eventservice.xml\ \ \ \ "; netconn_write(client, buf, strlen(buf), NETCONN_COPY); } netbuf_delete(nb); } printf("Closing connection\n"); netconn_close(client); netconn_delete(client); } }