3 Replies Latest reply on Mar 28, 2018 8:05 PM by zhez

    My http server is locked when I disconnect and connect to the access point

    rafraf_2990461

      Hello

       

      I am implementing a server with my ISM4319_TESTBOARD. For this I am using the function:

       

      wiced_http_server_start ( & ap_http_server, 80, max_sockets, web_pages, WICED_AP_INTERFACE, DEFAULT_URL_PROCESSOR_STACK_SIZE );

       

      where:

      max_sockets = 5;

       

      Once this is done, a client device can connect to the access point of my server and make http requests.

       

      The problem occurs when the client disconnects and reconnects from my access point. After trying "max_sockets" my server gets stuck and does not respond to client requests,

       

      I have noticed that if before the client disconnects from my server, I stop the http port with the function:

       

      wiced_http_server_stop (& ap_http_server);

       

       

      and then I start again the http port, my server is no longer locked when I disconnect and reconnect to the access point, however this solution is not very useful, since I can not detect when a client is connected to my access point of unless the client makes an http request.

       

      My two questions are:

       

      How can I detect when a client device has just connected to the access point of my server, without having sent a request to the server?

       

      Is there any other way to prevent my server from locking without having to restart my http port?

       

       

      I would greatly appreciate your help.

        • 1. Re: My http server is locked when I disconnect and connect to the access point
          zhez

          Hi  raf:

           

          For your first question:

          I think you can have a reference from below method in wwd_wifi.c

          wwd_wifi_get_associated_client_list  ,  you can initialize a timer to get the associated client list in your application,  and the usage is included in this function.   I have tested this function , it can get accurate Mac address associated.

           

          For your second question:

          I run the http test based on apsta in snip with chip 43907, sorry i don't have the board of your type in my hand.   It has no problem with a 5G AP mode . and the steps are:

          1.  application start, PC connect to the softAP created.

          2.  visit the host web address.

          3.  disconnect the PC connection.

          4.   reconnected,  visit the host address again, and didn't restart the HTTP port.

           

          wwd_result_t wwd_wifi_deauth_all_associated_client_stas( wwd_dot11_reason_code_t reason, wwd_interface_t interface )

          {

              uint8_t* buffer      = NULL;

              wiced_maclist_t* clients     = NULL;

              const wiced_mac_t* current;

              wwd_result_t result;

              wl_bss_info_t ap_info;

              wiced_security_t sec;

              uint32_t max_clients = 0;

              size_t size        = 0;

           

              result = wwd_wifi_get_max_associations( &max_clients );

              if ( result != WWD_SUCCESS )

              {

          WPRINT_APP_INFO( ("Failed to get max number of associated clients\n") );

          max_clients = 5;

              }

           

              size = ( sizeof(uint32_t) + (max_clients * sizeof(wiced_mac_t)));

              buffer = calloc( 1, size );

           

              if ( buffer == NULL )

              {

          WPRINT_APP_INFO(( "Unable to allocate memory for associated clients list\n" ));

          return WWD_MALLOC_FAILURE;

              }

           

              clients = (wiced_maclist_t*)buffer;

              clients->count = max_clients;

              memset(&ap_info, 0, sizeof(wl_bss_info_t));

           

              result = wwd_wifi_get_associated_client_list( clients, ( uint16_t )size );

              if ( result != WWD_SUCCESS )

              {

          WPRINT_APP_INFO(( "Failed to get client list\n" ));

          free( buffer );

          return result;

              }

           

              current = &clients->mac_list[0];

              wwd_wifi_get_ap_info( &ap_info, &sec );

           

              while ((clients->count > 0) && (!(NULL_MAC(current->octet))))

              {

          if (memcmp(current->octet, &(ap_info.BSSID), sizeof(wiced_mac_t) ) != 0)

          {

          WPRINT_APP_INFO(("Deauthenticating STA MAC: %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\n", current->octet[0], current->octet[1], current->octet[2], current->octet[3], current->octet[4], current->octet[5]));

          result = wwd_wifi_deauth_sta(current, reason, interface );

          if ( result  != WWD_SUCCESS)

          {

          WPRINT_APP_INFO(("Failed to deauth client\n"));

          }

          }

           

          --clients->count;

          ++current;

              }

           

              free( buffer );

           

              return WWD_SUCCESS;

          }

          • 2. Re: My http server is locked when I disconnect and connect to the access point
            axel.lin_1746341

            Which SDK version/RTOS/Network stack are you using?

            • 3. Re: My http server is locked when I disconnect and connect to the access point
              zhez

              Hi Raf:

               

              For how to get the info when a sta is joining the AP  Wiced_wifi_register_softap_event_handle is the correct choice from another question you raised. thanks.