One more question for this:
What if I send tcp/udp packet in Link Down status (when link_down_callback() is called).
Will the system automatically bring up network and process sending packet?
Or the sending packet action just fails?
I'm a bit nervous about this.
I suppose the network is up and always up after wiced_network_up().
I have a http server running for my application.
So if the system automatically calls link down, the client cannot
make connection at that time.
In what kind of situation the system will call link_up/link_down?
After adding debug code, I found:
The link down is triggered by WLC_E_DEAUTH_IND /** 802.11 DEAUTH indication */
in WICED/internal/wifi.c wiced_link_events_handler() line 690
A following link up is then called by handshake_error_callback() line 581
Is this normal? Any idea about this issue?
The system will NOT automatically bring up the Link for you. Sending packets will fail when the Link is down.
You cannot make this assumption that the network will always be active and available.
There can be a number of reasons why the LINK could go down - Including the AP being powered off, or the device or AP moving out of range, or a large number of devices in the network causing interference, or for most enterprise APs - automatic disconnect after a certain period of inactivity.
So your application does need to catch the link down events, and react as appropriate - either by re-establishing the link immediately or establishing it before trying to send additional data.