1# Civetweb API Reference
2
3### `mg_get_response( conn, ebuf, ebuf_len, timeout );`
4
5### Parameters
6
7| Parameter | Type | Description |
8| :--- | :--- | :--- |
9|**`conn`**|`struct mg_connection *`|The connection to listen on|
10|**`ebuf`**|`char *`|Buffer to store an error message|
11|**`ebuf_len`**|`size_t`|Size of the error message buffer including the terminating NUL|
12|**`timeout`**|`int`|Time to wait for a response in milliseconds|
13
14### Return Value
15
16| Type | Description |
17| :--- | :--- |
18|`int`|Success value of the wait|
19
20### Description
21
22The function `mg_get_reponse()` wait for a response from a remote server. A return value equal or greater than zero is an indication for success, a negative value us used to signal an error condition. A timeout can be specified which lets the function return after a specified number of milliseconds, even if no data is received from the remote party. If the timeout value is negative, the function will not return until data has been read or an unrecoverable error occurs.
23
24Error messages are stored in a caller supplied error message buffer.
25
26### See Also
27
28* [`mg_connect_client();`](mg_connect_client.md)
29* [`mg_connect_client_secure();`](mg_connect_client_secure.md)
30