nRF51 IoT SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
TCP

Transmission Control Protocol (TCP) is one of the core IP Protocols. It is a connection oriented protocol and provides reliable transport. This reliability comes at the cost of control packets overhead of the protocol itself, making it unsuitable for bandwidth constrained applications.

To demonstrate TCP protocol support on nRF51, lwIP stack is used. Nordic's stack does not currently support TCP.

As TCP is used as transport for the application, the actual physical transport used to communicate between TCP server and client does not matter as long as they are reachable at IPv6 level. Figure 1 below emphasizes on this fact by showing that the complementary role for nRF51 TCP server or client could be PC applications.

lwIP_TCP_Overall.svg
Figure 1: Setup of lwIP based IPv6 TCP examples.

The TCP client acts as an echo client sending requests to which the TCP server responds as demostrated in the MSC below.

msc_lwip_tcp_client_n_server
Figure 2: TCP data exchange.

Note
The client does not wait for the response before sending the next request. Requests are sent periodically every 200 ms. An initial delay of 2 s before sending the requests periodically is used to ensure neighbor discovery procedures are complete and the system has a global address that can be used to reach out to devices outside the link-local scope. The server itself does not ever initiate a request to the client.

Client

Server