I am looking for code to create REST server in AP mode. What I have.
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_AP) );
ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_AP, &wifi_config) );
struct sockaddr_in socketAddress;
memset(&socketAddress, 0, sizeof(socketAddress));
socketAddress.sin_family = AF_INET;
socketAddress.sin_addr.s_addr = htonl(INADDR_ANY);
socketAddress.sin_port = htons(80);
int ret = bind(socket, (struct sockaddr *)&socketAddress, sizeof(socketAddress));
if (ret) {ESP_LOGI(TAG, "failed 1!"); goto network_task_finish;}
ret = listen(socket, 32);
if (ret) {ESP_LOGI(TAG, "failed 2!"); goto network_task_finish;}
Access Point and Server
-
- Posts: 9833
- Joined: Thu Nov 26, 2015 4:08 am
Re: Access Point and Server
Okay, we're happy for you, that is a great start! Did you have a specific question in mind when you started this topic?
Who is online
Users browsing this forum: No registered users and 119 guests