Page 1 of 1

Access Point and Server

Posted: Wed Dec 07, 2016 10:01 pm
by KanyeKanye
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;}

Re: Access Point and Server

Posted: Thu Dec 08, 2016 1:21 am
by ESP_Sprite
Okay, we're happy for you, that is a great start! Did you have a specific question in mind when you started this topic?