Socket
IPC Socket API. More...
Data Structures | |
struct | socket_conn |
PubSub connection structure. More... | |
Functions | |
bool | kprv_socket_server_setup (socket_conn *conn, uint16_t port, uint8_t num_connections) |
Performs the low level init and setup of the server side tcp socket. More... | |
bool | kprv_socket_server_accept (const socket_conn *server_conn, socket_conn *client_conn) |
Attempts to accept a new socket connection - currently blocking. More... | |
bool | kprv_socket_client_connect (socket_conn *conn, uint16_t port) |
Attempts to open a socket connection. More... | |
bool | kprv_socket_close (socket_conn *conn) |
Performs low level shutdown and closure of connection. More... | |
bool | kprv_socket_send (const socket_conn *conn, const uint8_t *data_buffer, uint32_t data_length) |
Performs socket send. More... | |
bool | kprv_socket_recv (const socket_conn *conn, uint8_t *data_buffer, uint32_t data_length, uint32_t *length_read) |
Performs socket receive. More... | |
Function Documentation
bool kprv_socket_client_connect | ( | socket_conn * | conn, |
uint16_t | port | ||
) |
Attempts to open a socket connection.
- Parameters
-
[out] conn pointer to socket_conn where connection info will be stored [in] port port to connect on
- Returns
- bool true if successful, otherwise false
bool kprv_socket_close | ( | socket_conn * | conn | ) |
Performs low level shutdown and closure of connection.
- Parameters
-
[in,out] conn pointer to socket_conn
- Returns
- bool true if successful, otherwise false
bool kprv_socket_recv | ( | const socket_conn * | conn, |
uint8_t * | data_buffer, | ||
uint32_t | data_length, | ||
uint32_t * | length_read | ||
) |
Performs socket receive.
- Parameters
-
[in] conn pointer to socket_conn [out] data_buffer buffer to write received data to [in] data_length max size of data buffer [out] length_read number of bytes actually received
- Returns
- bool true if successful, otherwise false
bool kprv_socket_send | ( | const socket_conn * | conn, |
const uint8_t * | data_buffer, | ||
uint32_t | data_length | ||
) |
Performs socket send.
- Parameters
-
[in] conn pointer to socket_conn [in] data_buffer data to send [in] data_length length of data to send
- Returns
- bool true if successful, otherwise false
bool kprv_socket_server_accept | ( | const socket_conn * | server_conn, |
socket_conn * | client_conn | ||
) |
Attempts to accept a new socket connection - currently blocking.
- Parameters
-
[in] server_conn pointer to socket_conn with listening socket info [out] client_conn pointer to socket_conn where accepted connection info is stored
- Returns
- bool true if successful, otherwise false
bool kprv_socket_server_setup | ( | socket_conn * | conn, |
uint16_t | port, | ||
uint8_t | num_connections | ||
) |
Performs the low level init and setup of the server side tcp socket.
- Parameters
-
[out] conn pointer to socket_conn where connection info will be stored [in] port port to listen for connections on [in] num_connections max number of connections to listen for
- Returns
- bool true if successful, otherwise false