5 Replies Latest reply on Jun 16, 2015 4:51 PM by hmoore

    wifi connect disconnect handling

      I'm having a strange issue when trying to test wifi connection and disconnection handling.

      In my code I've written handlers for link_up and link_down.

      In another thread, I'm pinging google.com.

      It all works fine when in the first run, but when I turn my wifi off ( it goes into link_down handler) and than up(it goes in link_up handler), ping always times out.

      What my guess is, there are some variables which needs to be reinitialized. I call


      in my link_down handler to make sure when next time my device connects to wifi router, it obtains proper ip address.

      But still no luck with pinging google after wifi reconnect. I'm attaching my source code herewith

        • 1. Re: wifi connect disconnect handling

          I observe the same issue, it seems link_up only work once.

          My test is very simple that just print something in link_up/down callback.

          The second time turn off AP than turn on AP, I don'e see link_up get called.

          • 2. Re: wifi connect disconnect handling

            Yeah it works sometimes, rest of the time it doesn't. Very much


            To resolve this problem, I start a thread which scans available networks

            and as soon as it finds one same as configured in dct, it will try to


            As soon as connection is done, it goes into link_up handler.



            Shatruddha Singh Kushwaha





            On Fri, Feb 6, 2015 at 9:55 AM, sam.lin <

            • 3. Re: wifi connect disconnect handling

              Another strange thing I noticed today

              Before that, a prelog to what I'm doing :

              I'm sending a "Hi" on ip address at port 80.

              At first startup it all works fine, when I disconnected and reconnected, I'm obtaining a new IP address through DHCP.

              Now in my observation I see that after reconnecting and obtaining new IP address, the message that I'm sending is still being sent using the previous IP address.

              I checked in my router log to see all the transactions happening through my router. There I see my my device has an IP address and my old IP address before reconnect was

              In the messages sent after reconnect, I still see packets being sent using


              So clearly new IP address obtained is not replacing the old one in the stack. I'm unable to find out where this is set.

              Can anybody help?

              • 4. Re: wifi connect disconnect handling



                Could you please provide sniffer trace for this test?



                • 5. Re: wifi connect disconnect handling

                  Discussion is being locked. If you have follow-up, please start a new discussion.