From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- src/civetweb/docs/api/mg_write.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/civetweb/docs/api/mg_write.md (limited to 'src/civetweb/docs/api/mg_write.md') diff --git a/src/civetweb/docs/api/mg_write.md b/src/civetweb/docs/api/mg_write.md new file mode 100644 index 00000000..d501857b --- /dev/null +++ b/src/civetweb/docs/api/mg_write.md @@ -0,0 +1,29 @@ +# Civetweb API Reference + +### `mg_write( conn, buf, len );` + +### Parameters + +| Parameter | Type | Description | +| :--- | :--- | :--- | +|**`conn`**|`struct mg_connection *`| A pointer to the connection to be used to send data | +|**`buf`**|`const void *`| A pointer to the blob of information to be sent | +|**`len`**|`size_t`| The amount of bytes to be sent | + +### Return Value + +| Type | Description | +| :--- | :--- | +|`int`| An integer indicating the amount of bytes sent, or failure | + +### Description + +The function `mg_write()` can be used to send a blob of arbitrary data over a connection. The size of the data is provided as a parameter. The only length limitation on this function is `MAX_INT`, because the return value of this function will turn negative with larger blocks of data, although they may have been sent correctly. The function returns the amount of bytes sent in case of success, the value **0** when the connection has been closed, and **-1** in case of an error. + +### See Also + +* [`mg_lock_connection();`](mg_lock_connection.md) +* [`mg_printf();`](mg_print.md) +* [`mg_unlock_connection();`](mg_unlock_connection.md) +* [`mg_websocket_client_write();`](mg_websocket_client_write.md) +* [`mg_websocket_write();`](mg_websocket_write.md) -- cgit v1.2.3