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]connpointer to socket_conn where connection info will be stored
[in]portport 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]connpointer 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]connpointer to socket_conn
[out]data_bufferbuffer to write received data to
[in]data_lengthmax size of data buffer
[out]length_readnumber 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]connpointer to socket_conn
[in]data_bufferdata to send
[in]data_lengthlength 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_connpointer to socket_conn with listening socket info
[out]client_connpointer 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]connpointer to socket_conn where connection info will be stored
[in]portport to listen for connections on
[in]num_connectionsmax number of connections to listen for
Returns
bool true if successful, otherwise false