]> git.proxmox.com Git - ceph.git/blob - ceph/src/civetweb/docs/api/mg_write.md
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / civetweb / docs / api / mg_write.md
1 # Civetweb API Reference
2
3 ### `mg_write( conn, buf, len );`
4
5 ### Parameters
6
7 | Parameter | Type | Description |
8 | :--- | :--- | :--- |
9 |**`conn`**|`struct mg_connection *`| A pointer to the connection to be used to send data |
10 |**`buf`**|`const void *`| A pointer to the blob of information to be sent |
11 |**`len`**|`size_t`| The amount of bytes to be sent |
12
13 ### Return Value
14
15 | Type | Description |
16 | :--- | :--- |
17 |`int`| An integer indicating the amount of bytes sent, or failure |
18
19 ### Description
20
21 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.
22
23 ### See Also
24
25 * [`mg_lock_connection();`](mg_lock_connection.md)
26 * [`mg_printf();`](mg_print.md)
27 * [`mg_unlock_connection();`](mg_unlock_connection.md)
28 * [`mg_websocket_client_write();`](mg_websocket_client_write.md)
29 * [`mg_websocket_write();`](mg_websocket_write.md)