Stopping a TCP server when WiFi down?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
user_2173276
Level 1
Level 1
First like received

Hi,

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?

//Peter

0 Likes
1 Reply
VikramR_26
Employee
Employee
25 sign-ins 10 sign-ins 10 comments on KBA

Hi Peter,

Sorry for delayed response, did you mange to figure this out ? Or do you still need help.

With the latest SDK avlb there is an api for stopping the server

wiced_https_server_stop()

HTH

Vik86

0 Likes