The figure below uses the Micrium proprietary socket API function calls. A similar example could be written using the BSD socket API.
Typically, after a TCP server starts, TCP clients can connect and send requests to the server. A TCP server waits until client connections arrive and then creates a dedicated TCP socket connection to process the client’s requests and reply back to the client (if necessary). This continues until either the client or the server closes the dedicated client-server connection. Also while handling multiple, simultaneous client-server connections, the TCP server can wait for new client-server connections
Stream Server (TCP Server)
This example presents a very basic client-server application over a TCP connection. The server presented is simply waits for a connection and send the string ‘Hello World!’
. See TCPIP API Reference Core for a list of all µC/TCP-IP socket API functions.
Stream Client (TCP Client)
The client of the listing below connects to the specified server and receives the string the server sends.
TCP Connection Configuration
µC/TCP-IP provides a set of APIs to configure TCP connections on an individual basis. These APIs are listed below and detailed in TCP Functions: