DriveWorks SDK Reference
5.8.83 Release
For Test and Development only

IPC Workflow

The following code snippet demonstrates the general structure of a server process receiving data:

dwSocketServer_accept(&connection, ...);
while(true)
{
// receive data from client
dwSocketConnection_read(&buffer, &buffer_size, timeout_us, connection);
}
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:

dwSocketClient_connect(&connection, ...);
while(true)
{
// send data to server
dwSocketConnection_write(&buffer, &buffer_size, timeout_us, connection);
}
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.