2 Replies Latest reply on May 22, 2015 5:46 PM by JaeyoungY_71

    TCP client socket stops transmitting when AP interface connects

      Using 2.4.1, I've run into a situation where a TCP client socket on the STA interface stops sending data after an AP connection is made simultaneously.


      Here is the problem in more detail:

      On power up, our device connects to the local Wi-Fi and then makes a TCP connection to a cloud service using the STA interface.  The connection to the cloud service is maintained in the background while the device is on.  In addition, if the user presses a button on the device, the AP interface powers up and starts the http & dns services to allow a user to interact with the device directly through an app.  Unfortunately, I have found that as soon as the user connects to the AP interface, the STA hosted TCP connection goes dead.  I have traced the traffic on the network and I see that once the AP connection is made, packets go into the STA based TCP port but nothing ever comes back out.

       

      Another odd fact is that everything works properly if the TCP socket is connecting to a host on my local network instead of out on the internet.  I don't think it's a DNS issue because I use the same functions to resolve a domain name in either case, I just change the IP address from an internet address to 192.168.1.101 at the DNS server.

       

      It is almost like the act of connecting to the AP interface messes up the TCP socket somehow.  Although I don't get any indication that anything is wrong inside the firmware.  The wiced_tcp_send_buffer() call returns WICED_SUCCESS even when it's actually failing.

       

      Development is very far along, so I'm not in a position to switch to 3.x.

        • 2. Re: TCP client socket stops transmitting when AP interface connects
          JaeyoungY_71

          Hi Jason,

           

          We've looked into the problem and were able to identify the error with NetX / NetX_Duo. We create separate NetX stack instances for each interface(STA / AP / P2P), and should have separate ARP caches as well. However in the previous code (3.1.2 and before) it was sharing the same ARP cache between all the interfaces. This was causing corruption in communication. We have tested the below solution out and can confirm this solves the problem for NetX and NetX_Duo. It will be fixed in the next SDK release, in the meanwhile you can apply the changes by the following.

           

          You can change the code in the following locations

              - /WICED/network/NetX/WICED/wiced_network.c

              - /WICED/network/NetX_Duo/WICED/wiced_network.c

           

          /******************************************************

          *                Static Variables

          ******************************************************/

           

          /* Network objects */

          ++ADD THE FOLLOWING++

          static char  wifi_sta_arp_cache[ARP_CACHE_SIZE];

          static char  wifi_ap_arp_cache[ARP_CACHE_SIZE];

          static char  wifi_p2p_arp_cache[ARP_CACHE_SIZE];

          #define WIFI_STA_ARP_CACHE    wifi_sta_arp_cache

          #define WIFI_AP_ARP_CACHE    wifi_ap_arp_cache

          #define WIFI_P2P_ARP_CACHE    wifi_p2p_arp_cache

           

          static char    wiced_ip_stack[3]    [IP_STACK_SIZE];

           

          --COMMENT OUT BELOW--

          //static char    wiced_arp_cache      [ARP_CACHE_SIZE];

           

          In the function wiced_ip_up()

           

          /* Enable ARP */

          --COMMENT OUT BELOW--

          //if ( nx_arp_enable( &IP_HANDLE(interface), (void *) wiced_arp_cache, ARP_CACHE_SIZE ) != NX_SUCCESS )

          ++ADD THE FOLLOWING++

          if ( nx_arp_enable( &IP_HANDLE(interface), (void *) ARP_FOR_IF( interface ), ARP_CACHE_SIZE ) != NX_SUCCESS )

           

          Unfortunately we could not duplicate this problem on LwIP. We will continue to look into this and will keep you posted on any findings. Thank you for your patience.

           

          Thanks,

          Jaeyoung