]> git.proxmox.com Git - ceph.git/blame - ceph/src/civetweb/docs/api/mg_connect_client.md
buildsys: switch source download to quincy
[ceph.git] / ceph / src / civetweb / docs / api / mg_connect_client.md
CommitLineData
11fdf7f2
TL
1# Civetweb API Reference
2
3### `mg_connect_client( host, port, use_ssl, error_buffer, error_buffer_size );`
4
5### Parameters
6
7| Parameter | Type | Description |
8| :--- | :--- | :--- |
9|**`host`**|`const char *`|hostname or IP address of the server|
10|**`port`**|`int`|The port to connect to on the server|
11|**`use_ssl`**|`int`|Connects using SSL of this value is not zero|
12|**`error_buffer`**|`char *`|Buffer to store an error message|
13|**`error_buffer_size`**|`size_t`|Maximum size of the error buffer including the NUL terminator|
14
15### Return Value
16
17| Type | Description |
18| :--- | :--- |
19|`struct mg_connection *`||
20
21### Description
22
23The function `mg_connect_client()` connects to a TCP server as a client. This server can be a HTTP server but this is not necessary. The function returns a pointer to a connection structure when the connection is established and NULL otherwise. The host may be on IPv4 or IPv6, but IPv6 is not enabled in every Civetweb installation. Specifically the use of IPv6 communications has to be enabled when the library is compiled. At runtime you can use the [`mg_check_feature()`](mg_check_feature.md) function with the parameter `USE_IPV6` to check if IPv6 communication is supported.
24
25### See Also
26
27* [`mg_check_feature();`](mg_check_feature.md)
28* [`mg_connect_client_secure();`](mg_connect_client_secure.md)
29* [`mg_connect_websocket_client();`](mg_connect_websocket_client.md)