Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

net_tcp.h/net_tcp.c

Prototype

Code Block
          CPU_BOOLEAN NetTCP_ConnCfgIdleTimeout(NET_TCP_CONN_ID      conn_id_tcp,
                                                NET_TCP_TIMEOUT_SEC  timeout_sec,
                                                NET_ERR             *perr);

Arguments

conn_id_tcp

TCP connection handle ID to configure connection handle timeout.

...

Available only if TCP is enabled (see TCP Layer Configuration).

Notes / Warnings

Configured timeout does not reschedule any current idle timeout in progress but becomes effective the next time a TCP connection sets its idle timeout.

The conn_id_tcp argument represents the TCP connection handle – not the socket handle. The following code may be used to get the TCP connection handle and configure TCP connection parameters (see also NetSock_GetConnTransportID):




Code Block
languagecpp
          NET_SOCK_ID     sock_id;
          NET_TCP_CONN_ID conn_id_tcp;
          NET_ERR         err;
           
          sock_id     = Application's TCP socket ID; /* Get application's TCP socket     ID. */
                                                     /* Get socket's      TCP connection ID. */
          conn_id_tcp = (NET_TCP_CONN_ID)NetSock_GetConnTransportID(sock_id, &err);
           
          if (err == NET_SOCK_ERR_NONE) {/* If NO errors, ...                                           */
                                         /* ... configure TCP connection maximum re-transmit threshold. */
              NetTCP_ConnCfgIdleTimeout(conn_id_tcp, 240u, &err);
          }


NetTCP_ConnCfgIdleTimeout() is called by application function(s) and must not be called with the global network lock already acquired. It must block all other network protocol tasks by pending on and acquiring the global network lock (see “net.h Note #3”). This is required since an application's network protocol suite API function access is asynchronous to other network protocol tasks
.