This chapter explains the software blocks needed to build a networking application. In addition, this chapter describes the recommended flow for most applications. The information provided is for guidance only. Programmers have complete flexibility on how to use the various software blocks. Programs using the SimpleLink device consist of the following software blocks:
- Wi-Fi subsystem initialization – Wakes the Wi-Fi subsystem from the hibernate state.
- Configuration – Refers to init time configuration that occurs infrequently, such as when changing the Wi-Fi subsystem from a WLAN STA to WLAN soft AP, changing the MAC address, and so forth.
- WLAN connection – The physical interface must be established. There are numerous ways to do so; the simplest way is to manually connect to an AP as a wireless station.
- DHCP – Although not an integral part of the WLAN connection, the user must wait for the receiving IP address before continuing to the next step of working with TCP and UDP sockets.
- Socket connection – At this point, the application must set up the TCP\IP layer. Separate this phase into the following parts:
- Creating the socket – Choose TCP, UDP, or RAW sockets, whether to use a client or a server socket, defining socket characteristics such as blocking or non-blocking, socket timeouts, and so forth.
- Querying for the server IP address – In most occasions, when implementing a client side communication, the remote server side IP address is unknown, which is required for establishing the socket connection. This can be done by using DNS protocol to query the server IP address by using the server name.
- Creating socket connection – When using the TCP socket, a proper socket connection must be established before performing a data transaction.
- Data transactions – Once the socket connection is established, transmit data both ways between the client and the server, by implementing the application logic.
- Socket disconnection – Upon finishing the required data transactions, TI recommends performing a graceful closure of the socket communication channel.
- Wi-Fi subsystem hibernate – When not working with the Wi-Fi subsystem for a long period of time, TI recommends putting it into hibernate mode.