Declare the type of socket callback function.

Syntax

typedef void (*tpfAppSocketCb)(
  SOCKET sock,
  unsigned char u8Msg,
  void *pvMsg
);

Parameters

sock
[in] Socket descriptor
u8Msg
[in] Message ID representing the type of message.
ValueDescription
SOCKET_MSG_BIND Result of BindSc function.
SOCKET_MSG_LISTEN Result of SyncListenSc function.
SOCKET_MSG_DNS_RESOLVE Internal use.
SOCKET_MSG_ACCEPT Result of AcceptSc function.
Or, a message indicating that there was a connection request from the client after executing the ListenSc function.
SOCKET_MSG_CONNECT Result of ConnectSc function.
SOCKET_MSG_RECV Result of RecvSc function.
SOCKET_MSG_SEND Result of SendSc function.
SOCKET_MSG_SENDTO Result of SendtoSc function.
SOCKET_MSG_RECVFROM Result of RecvfromSc function.
pvMsg
[in] A pointer to the message data.

Return value

 None

Remarks

Declare the type of callback function specified in the pfAppSocketCb parameter of the RegSocketCallbackSc function.

When a user calls an asynchronous socket function, the processing request is queued and processed asynchronously. When the requested processing is completed, the callback function is called to return the message data representing the processing result to the user.

The u8Msg parameter of the callback function is passed a message ID that indicates the type of message, and the pvMsg parameter is passed a pointer that points to the message data that stores the processing result.
The type of message data differs depending on the type of message. See each asynchronous socket function for details.

Requirements

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

Last updated: 2020/11/26