sppConn()

PROTOTYPE

#include <spp.h>

int sppConn(void);

DESCRIPTION

sppConn() establishes or re-establishes a connection. If the channel is already connected when it is called, the call succeeds and returns immediately. Otherwise, it puts the channel in the LINK_SETUP state.

If configured in active mode, sppConn() starts periodic transmission of SYN frames at the interval specified by configuration parameter T1. In passive mode, sppConn() merely waits to respond to incoming SYN frames. When a node in the LINK_SETUP state receives a SYN frame, it sends an ACK response and establishes a new connection.

If configured to be non-blocking, sppConn() returns immediately after putting the channel in LINK_SETUP state. Otherwise, it blocks until a connection is established.

If successful, sppConn() returns 0. Otherwise, it sets errno and returns -1.

ERROR CODES

SPP_INPROGRESS A prior sppConn() call is in-progress.
SPP_UNCONNECTED SppConn() did not succeed in making a connection.
SPP_UNINITIALIZED The initialization routine sppInit() has not been called.
SPP_WOULD_BLOCK A connection has been initiated, but the API is non-blocking.
SPP_NOCONFIG The channel has not been configured using sppConfig().

EXAMPLE

    /*-----------------------------------------------------------------*/
    /* Connect the channel.                                            */
    /*-----------------------------------------------------------------*/
    do
      rc = sppConn();
    while (rc);