#include <stddef.h>
Go to the source code of this file.
Callback for closing socket. Applications must implement this callback in the target enviroment.
- Parameters
-
[in] | socket_context | context object. |
- Returns
- If applications succeed to close socket, applications need to return KII_SOCKETC_OK. If applications fail to close socket, applications need to return KII_SOCKETC_FAIL. If applications want to pend returning success or fail, applications need to return KII_SOCKETC_AGAIN.
Callback for connecting socket to server. Applications must implement this callback in the target enviroment.
- Parameters
-
[in] | socket_context | context object. |
[in] | host | host name. |
[in] | port | port number. |
- Returns
- If connection is succeeded, applications need to return KII_SOCKETC_OK. If connection is failed, applications need to return KII_SOCKETC_FAIL. If applications want to pend returning success or fail, applications need to return KII_SOCKETC_AGAIN.
Callback for receiving data from server. Applications must implement this callback in the target enviroment.
- Parameters
-
[in] | socket_context | context object. |
[out] | buffer | buffer to set receiving data. |
[in] | length_to_read | buffer size. |
[out] | out_actual_length | actual set data size. |
- Returns
- If applications succeed to receive data and set the data to buffer, applications need to return KII_SOCKETC_OK. Applications also set data size to out_actual_length. If applications fail, applications need to return KII_HTTPC_FAIL. If applications want to wait to receive data, applications need to return KII_HTTPC_AGAIN. In this case, applications must not set receving data to buffer if some data is received.
Callback for sending data to server. Applications must implement this callback in the target enviroment.
- Parameters
-
[in] | socket_context | context object. |
[in] | buffer | data to send server. |
[in] | length | length of buffer. |
- Returns
- If applications succeed to send data, applications need to return KII_SOCKETC_OK. If connection is failed. applications need to return KII_SOCKETC__FAIL. If applications don't want to send data, applications need to return KII_SOCKETC_AGAIN. In this case, KiiThingSDK Embedded Core pass same data to this callback again.
Enumerator |
---|
KII_HTTP_ERROR_NONE |
No error.
|
KII_HTTP_ERROR_INVALID_RESPONSE |
Invalid response.
|
KII_HTTP_ERROR_INSUFFICIENT_BUFFER |
Response buffer overflow.
|
KII_HTTP_ERROR_SOCKET |
Socket functions returns false.
|
Enumerator |
---|
KII_SOCKETC_OK |
Retrun this code when operation succeed.
|
KII_SOCKETC_FAIL |
Return this code when operation failed.
|
KII_SOCKETC_AGAIN |
Return this code when operation is in progress.
SDK calls the callback again until the callbacks returns
KII_SOCKETC_OK or KII_SOCKETC_FAIL. |