Access Point and Server

KanyeKanye
Posts: 54
Joined: Mon Dec 05, 2016 12:34 am

Access Point and Server

Postby KanyeKanye » Wed Dec 07, 2016 10:01 pm

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;}

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: Access Point and Server

Postby ESP_Sprite » Thu Dec 08, 2016 1:21 am

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: Majestic-12 [Bot] and 114 guests