This function starts accepting socket connections.

Syntax

char ListenSc(
  SOCKET sock, 
  unsigned char backlog
);

Parameters

sock
[in] Socket descriptor
backlog
[in] Please specify 0.

Return value

The following values will be returned.
ValueDescription
SOCK_ERR_NO_ERROR Succeeded
M2M_ERR_SLEEP_FAIL Initialize with SysWLANInit function.
Other than the above Failed

Remarks

This function starts accepting socket connections.
Only available on TCP sockets.

The processing request of this function is processed asynchronously. The processing result is received by the callback function specified by the pfAppSocketCb parameter of the RegSocketCallbackSc function. The following values are passed to the parameters of the callback function.
sock
Socket descriptor
u8Msg
SOCKET_MSG_LISTEN
pvMsg
A pointer to the tstrSocketListenMsg structure that stores the processing result.


tstrSocketListenMsg structure (typedef)

Syntax

typedef struct
{
    signed char  status;
} tstrSocketListenMsg;

Members

status
Returns 0 if the ListenSc process is successful, otherwise it returns a negative value.


Requirements

Header file:
lib.h
Library file:
libSTARTUPOPH5000.a

Sample

Last updated: 2020/11/26