SPNA248 March 2021 TM4C1292NCPDT , TM4C1292NCPDT , TM4C1292NCZAD , TM4C1292NCZAD , TM4C1294KCPDT , TM4C1294KCPDT , TM4C1294NCPDT , TM4C1294NCPDT , TM4C1294NCZAD , TM4C1294NCZAD , TM4C1299KCZAD , TM4C1299KCZAD , TM4C1299NCZAD , TM4C1299NCZAD , TM4C129DNCPDT , TM4C129DNCPDT , TM4C129DNCZAD , TM4C129DNCZAD , TM4C129EKCPDT , TM4C129EKCPDT , TM4C129ENCPDT , TM4C129ENCPDT , TM4C129ENCZAD , TM4C129ENCZAD , TM4C129LNCZAD , TM4C129LNCZAD , TM4C129XKCZAD , TM4C129XKCZAD , TM4C129XNCZAD , TM4C129XNCZAD
The enet_tcpecho_client_lwip example demonstrates a client application that first connects to the server with a greetings message “Hello World!\n\r” and then echoes back whatever it receives from the server.
As illustrated in lwIP flowchart for TCP in Figure 1-1, the client will use tcp_connect() to connect to the specified server address and port. Once the connection is established, the client will use tcp_recv() to setup a callback function for receiving data from the server and then echo the data back.
Another difference between the client and server in the flowchart is that the client doesn’t need to call tcp_bind(). Binding is normally not needed on the client side for TCP. There may be circumstances where binding the client is needed in which you will use tcp_bind() to bind the client. An example would be a firewall on the client that only allows outgoing connections on a certain port.