Provides functionality for inter-process communication (IPC).
- Note
- SW Release Applicability: These APIs are available in both NVIDIA DriveWorks and NVIDIA DRIVE Software releases.
|
DW_API_PUBLIC dwStatus | dwSocketClient_broadcast (const uint8_t *buffer, size_t buffer_size, dwSocketClientHandle_t client) |
| Broadcasts a message to all connected sockets of the pool. More...
|
|
DW_API_PUBLIC dwStatus | dwSocketClient_connect (dwSocketConnectionHandle_t *connection, const char8_t *host, uint16_t port, dwTime_t timeout_us, dwSocketClientHandle_t client) |
| Connects a socket connection to a listening socket server. More...
|
|
DW_API_PUBLIC dwStatus | dwSocketClient_initialize (dwSocketClientHandle_t *client, size_t connection_pool_size, dwContextHandle_t context) |
| Creates and initializes a socket client. More...
|
|
DW_API_PUBLIC dwStatus | dwSocketClient_release (dwSocketClientHandle_t client) |
| Terminate a socket client. More...
|
|
DW_API_PUBLIC dwStatus | dwSocketConnection_peek (uint8_t *buffer, size_t *buffer_size, dwTime_t timeout_us, dwSocketConnectionHandle_t connection) |
| Peek at a message of a given length from the network connection (blocking within timeout period). More...
|
|
DW_API_PUBLIC dwStatus | dwSocketConnection_read (void *buffer, size_t *buffer_size, dwTime_t timeout_us, dwSocketConnectionHandle_t connection) |
| Receive a message of a given length from the network connection. More...
|
|
DW_API_PUBLIC dwStatus | dwSocketConnection_release (dwSocketConnectionHandle_t connection) |
| Terminate a socket connection. More...
|
|
DW_API_PUBLIC dwStatus | dwSocketConnection_write (const void *buffer, size_t *buffer_size, dwTime_t timeout_us, dwSocketConnectionHandle_t connection) |
| Send a message of a given length through the socket connection with a timeout. More...
|
|
DW_API_PUBLIC dwStatus | dwSocketServer_accept (dwSocketConnectionHandle_t *connection, dwTime_t timeout_us, dwSocketServerHandle_t server) |
| Accepts an incoming connection at a socket server. More...
|
|
DW_API_PUBLIC dwStatus | dwSocketServer_broadcast (const uint8_t *buffer, size_t buffer_size, dwSocketServerHandle_t server) |
| Broadcasts a message to all connected sockets of the pool. More...
|
|
DW_API_PUBLIC dwStatus | dwSocketServer_initialize (dwSocketServerHandle_t *server, uint16_t port, size_t connection_pool_size, dwContextHandle_t context) |
| Creates and initializes a socket server accepting incoming client connections. More...
|
|
DW_API_PUBLIC dwStatus | dwSocketServer_release (dwSocketServerHandle_t server) |
| Terminate a socket server. More...
|
|
◆ dwSocketAddrIn
Data Fields |
uint32_t |
ip |
|
uint16_t |
port |
|
◆ dwSocketClientHandle_t
◆ dwSocketConnectionHandle_t
Handle representing the a bi-directional client-server network socket connection.
Definition at line 68 of file SocketClientServer.h.
◆ dwSocketServerHandle_t
◆ dwSocketClient_broadcast()
Broadcasts a message to all connected sockets of the pool.
- Parameters
-
[in] | buffer | A pointer to the data to be send. |
[in] | buffer_size | The number of bytes to send. |
[in] | client | A handle to the socket client. |
- Returns
- DW_INVALID_HANDLE - if buffer or socket handle is invalid, i.e. null or of wrong type
DW_FAILURE - if a single message was not send successfully to all connections.
DW_SUCCESS - if all messages to all connections were send successfully.
◆ dwSocketClient_connect()
Connects a socket connection to a listening socket server.
- Parameters
-
[out] | connection | A pointer to the socket connection handle will be returned here. |
[in] | host | A pointer to string representation of the the server's IP address or hostname. |
[in] | port | The network port the server is listening on. |
[in] | timeout_us | Timeout to block this call. |
[in] | client | A handle to the socket client. |
- Returns
- DW_BUFFER_FULL - if the clients's connection pool is depleted.
DW_CANNOT_CREATE_OBJECT - if the socket can't be created or the server's IP/hostname is invalid
DW_TIME_OUT - if no connection could be accepted before the timeout.
DW_INVALID_ARGUMENT - if the client handle is invalid.
DW_SUCCESS - if a socket connection was established.
◆ dwSocketClient_initialize()
Creates and initializes a socket client.
- Parameters
-
[out] | client | A pointer to the client handle will be returned here. |
[in] | connection_pool_size | The maximal number of concurrently connected connections. |
[in] | context | Specifies the handle to the context under which the socket client is created. |
- Returns
- DW_INVALID_HANDLE - if provided context handle is invalid, i.e. null or of wrong type
DW_SUCCESS - when client was created successfully.
◆ dwSocketClient_release()
Terminate a socket client.
- Parameters
-
[in] | client | A handle to the socket client. |
- Returns
- DW_FAILURE - if client was not terminated cleanly
DW_SUCCESS - if client was terminated cleanly.
◆ dwSocketConnection_peek()
Peek at a message of a given length from the network connection (blocking within timeout period).
- Parameters
-
[in] | buffer | A pointer to the memory location data is written to. |
[in,out] | buffer_size | A pointer to the number of bytes to receive, and the actual number of bytes received on success. |
[in] | timeout_us | Timeout to block this call. Specify 0 for non-blocking behavior. Specify DW_TIMEOUT_INFINITE for infinitely blocking behavior until data is available. |
[in] | connection | A handle to the network socket connection. |
- Returns
- DW_INVALID_HANDLE - if buffer or socket handle is invalid,i.e. null or of wrong type
DW_END_OF_STREAM - if the connection ended.
DW_TIME_OUT - if no data is available to be received before the timeout.
DW_FAILURE - if data could not be received or timeout could not be set.
DW_SUCCESS - if data could be received.
◆ dwSocketConnection_read()
Receive a message of a given length from the network connection.
The method blocks for the provided amount of time to receive the data.
- Parameters
-
[in] | buffer | A pointer to the memory location data is written to. |
[in,out] | buffer_size | A pointer to the number of bytes to receive, and the actual number of bytes received. |
[in] | timeout_us | Time to wait to receive the content. Can be 0 for non-blocking and DW_TIMEOUT_INFINITE for blocking mode |
[in] | connection | A handle to the network socket connection. |
- Returns
- DW_INVALID_HANDLE - if buffer or socket handle is invalid,i.e. null or of wrong type
DW_END_OF_STREAM - if the connection ended.
DW_TIME_OUT - if timed out before any data could be received
DW_FAILURE - if data could not be received.
DW_SUCCESS - if data could be received.
◆ dwSocketConnection_release()
Terminate a socket connection.
- Parameters
-
[in] | connection | A handle to the socket connection. |
- Returns
- DW_FAILURE - if connection was not terminated cleanly
DW_SUCCESS - if connection was terminated cleanly.
◆ dwSocketConnection_write()
Send a message of a given length through the socket connection with a timeout.
While sending has not timedout, the buffer will be retried to be sent as long as possible.
- Parameters
-
[in] | buffer | A pointer to the data to be send. |
[in,out] | buffer_size | A pointer to the number of bytes to send, and the actual number of bytes sent. |
[in] | timeout_us | Amount of time to try to send the data |
[in] | connection | A handle to the network socket connection. |
- Returns
- DW_INVALID_HANDLE - if buffer or socket handle is invalid,i.e. null or of wrong type
DW_END_OF_STREAM - if the connection ended.
DW_FAILURE - if data could not be transmitted.
DW_TIME_OUT - if no data could be transmitted within the requested timeout time.
DW_SUCCESS - if data could be send.
- Note
- Even if the method times out, at least partially the data could have been sent.
◆ dwSocketServer_accept()
Accepts an incoming connection at a socket server.
- Parameters
-
[out] | connection | A pointer to the socket connection handle will be returned here. |
[in] | timeout_us | Timeout to block this call. |
[in] | server | A handle to the socket server. |
- Returns
- DW_BUFFER_FULL - if the server's connection pool is depleted.
DW_TIME_OUT - if no connection could be accepted before the timeout.
DW_INVALID_ARGUMENT - if the server handle is invalid.
DW_SUCCESS - if a socket connection was established.
◆ dwSocketServer_broadcast()
Broadcasts a message to all connected sockets of the pool.
- Parameters
-
[in] | buffer | A pointer to the data to be send. |
[in] | buffer_size | The number of bytes to send. |
[in] | server | A handle to the socket server. |
- Returns
- DW_INVALID_HANDLE - if buffer or socket handle is invalid,i.e. null or of wrong type
DW_FAILURE - if a single message was not send successfully to all connections.
DW_SUCCESS - if all messages to all connections were send successfully.
◆ dwSocketServer_initialize()
Creates and initializes a socket server accepting incoming client connections.
- Parameters
-
[out] | server | A pointer to the server handle will be returned here. |
[in] | port | The network port the server is listening on. |
[in] | connection_pool_size | The maximal number of concurrently acceptable connections. |
[in] | context | Specifies the handle to the context under which the socket server is created. |
- Returns
- DW_CANNOT_CREATE_OBJECT - if socket initialization failed.
DW_INVALID_HANDLE - if provided context handle is invalid,i.e. null or of wrong type
DW_SUCCESS - if server is created successfully.
◆ dwSocketServer_release()
Terminate a socket server.
- Parameters
-
[in] | server | A handle to the socket server. |
- Returns
- DW_FAILURE - if server was not terminated cleanly
DW_SUCCESS - if server was terminated cleanly.