1 Reply Latest reply on Oct 16, 2015 1:07 PM by VikramR_26 Branched from an earlier discussion.

    Stopping a TCP server when WiFi down?




      I only get the first linkdown callback when I turn off AP.


      I also have a TCP server which is very similiar to Wiced http_server or snip/tcp_server.c.

      When I get a linkdown I want to:

      1. Stop the server by setting the quit flag in the server thread loop.
      2. Bring down network with wiced_network_down()
      3. Then wait a while and try to connect to same or another AP in the DCT list with wiced_network_up().

      After step 2 I get a reboot (watchdog?) or a System_monitor stop/reboot. TCP thread is watched by system monitor.

      If I wait before stopping TCP server or delete the TCP socket it works and WiFi will come up again when it finds an AP. But I get a huge memory leak. ~20kbytes

      Thinking about doing a reboot but it seems a bit crude.


      How do I stop a TCP server when Wi-Fi is down?