Stream socket connection.
More...
VTM_API struct vtm_socket_con* vtm_socket_con_new |
( |
vtm_socket * |
sock | ) |
|
Creates and initializes a new socket connection on the heap.
- Parameters
-
sock | the socket that should be associated with the connection |
- Returns
- the created connection
-
NULL if memory allocation or initialization failed
Releases a socket connection and frees the pointer.
After this call the connection pointer is no longer valid.
- Parameters
-
con | the connection that should be released |
VTM_API int vtm_socket_con_init |
( |
struct vtm_socket_con * |
con, |
|
|
vtm_socket * |
sock |
|
) |
| |
Initializes a new socket connection.
- Returns
- VTM_OK if the initialization was successful
-
VTM_ERROR if an error occured
Releases a socket connection.
After this call the connection structure is no longer valid.
- Parameters
-
con | the connection that should be released |
VTM_API void vtm_socket_con_set_usr_data |
( |
struct vtm_socket_con * |
con, |
|
|
void * |
data |
|
) |
| |
Stores arbitrary user data with the connection.
- Parameters
-
con | the connection that should store the user data |
data | the data that should be stored |
VTM_API void* vtm_socket_con_get_usr_data |
( |
struct vtm_socket_con * |
con | ) |
|
Retrieves the stored user data.
- Parameters
-
- Returns
- the previous saved user data
-
NULL if no data was stored
Locks the internal writer buffer.
This method must be called if new data should be stored in the output buffer of the connection.
- Parameters
-
con | the connection that should be locked |
VTM_API void vtm_socket_con_write_unlock |
( |
struct vtm_socket_con * |
con | ) |
|
Unlocks the internal writer buffer.
This method must be called after new data was tored in the output buffer of the connection.
- Parameters
-
con | the connection that should be unlocked |
Starts sending the contents of the output buffer.
vtm_socket_con_write_lock() must be called prior to this function.
- Parameters
-
con | the connection that should send data |
- Returns
- VTM_OK if the call succeed
-
VTM_ERROR if an error occured
Sends the next chunk of data from the output buffer
- Parameters
-
con | the connection that should send data |
- Returns
- VTM_OK if all remaining data was sent
-
VTM_E_IO_AGAIN if the function must be called again later
-
VTM_E_IO_CLOSED if the connection was closed
-
VTM_E_IO_UNKNOWN or VTM_ERROR if an error occured