The following code snippet demonstrates the general structure of a server process receiving data:
while(true)
{
}
DW_API_PUBLIC dwStatus dwSocketConnection_read(void *const buffer, size_t *const bufferSize, dwTime_t const timeoutUs, dwSocketConnectionHandle_t const connection)
Receive a message of a given length from the network connection.
DW_API_PUBLIC dwStatus dwSocketServer_initialize(dwSocketServerHandle_t *const server, uint16_t const port, size_t const connectionPoolSize, dwConstContextHandle_t const context)
Creates and initializes a socket server accepting incoming client connections.
DW_API_PUBLIC dwStatus dwSocketServer_accept(dwSocketConnectionHandle_t *const connection, dwTime_t const timeoutUs, dwSocketServerHandle_t const server)
Accepts an incoming connection at a socket server.
The following code snippet demonstrates the general structure of a corresponding client process sending data:
while(true)
{
}
DW_API_PUBLIC dwStatus dwSocketClient_connect(dwSocketConnectionHandle_t *const connection, char8_t const *const host, uint16_t const port, dwTime_t const timeoutUs, dwSocketClientHandle_t const client)
Connects a socket connection to a listening socket server.
DW_API_PUBLIC dwStatus dwSocketClient_initialize(dwSocketClientHandle_t *const client, size_t const connectionPoolSize, dwConstContextHandle_t const context)
Creates and initializes a socket client.
DW_API_PUBLIC dwStatus dwSocketConnection_write(const void *const buffer, size_t *const bufferSize, dwTime_t const timeoutUs, dwSocketConnectionHandle_t const connection)
Send a message of a given length through the socket connection with a timeout.
This workflow is demonstrated in the following sample: Inter-process Communication (IPC) Sample.