Nonblocking data transmission.
More...
Enumerator |
---|
VTM_SOCK_EMIT_AGAIN |
There is still data that needs to be transmitted
|
VTM_SOCK_EMIT_COMPLETE |
All data was transmitted
|
VTM_SOCK_EMIT_ERROR |
An error occured while transmitting data
|
Releases the given emitter and all other linked emitters in the chain.
- Parameters
-
se | the socket emitter that should be released |
Releases the given emitter.
- Parameters
-
se | the socket emitter that should be released |
VTM_API struct vtm_socket_emitter* vtm_socket_emitter_for_raw |
( |
vtm_socket * |
sock, |
|
|
const void * |
src, |
|
|
size_t |
len |
|
) |
| |
Creates a new socket emitter for sending a raw memory chunk.
- Parameters
-
sock | the socket that should be used by the emitter |
src | pointer to the memory chunk |
len | the size of the memory chunk in bytes |
- Returns
- the created emitter
-
NULL if an error occured
Creates a new socket emitter for sending the contents of buffer.
- Parameters
-
sock | the socket that should be used by the emitter |
buf | the buffer whose contents should be sent |
fr | if true the buffer is released when the emitter is released |
- Returns
- the created emitter
-
NULL if an error occured
VTM_API struct vtm_socket_emitter* vtm_socket_emitter_for_file |
( |
vtm_socket * |
sock, |
|
|
FILE * |
fp |
|
) |
| |
Creates a new socket emitter for sending the contents of file.
- Parameters
-
sock | the socket that should be used by the emitter |
fp | the already opened file |
- Returns
- the created emitter
-
NULL if an error occured
Tries to send the data of all emitters in the chain immediately.
Emitters that were able to send their data completely are automatically released.
- Parameters
-
[in,out] | se | pointer to pointer to root emitter. |
- Returns
- VTM_OK if the data of all emitters was transmitted successfully
-
VTM_E_IO_AGAIN if only some data was transmitted. In this case the se parameter points to the emitter that is now the head of the chain.
-
VTM_E_IO_UNKNOWN or VTM_ERROR if an error occured
VTM_API int vtm_socket_emitter_get_chain_lensum |
( |
struct vtm_socket_emitter * |
se, |
|
|
uint64_t * |
out_sum |
|
) |
| |
Calculates the sum of all length specifications of the emitter chain.
- Parameters
-
| se | the root emitter |
[out] | out_sum | the total number in bytes |
- Returns
- VTM_OK if the sum was calculated successfully
-
VTM_ERROR if an error occured