File: mg_get_server_ports.md

package info (click to toggle)
civetweb 1.16%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 4,576 kB
  • sloc: ansic: 32,463; cpp: 1,374; sh: 480; javascript: 204; makefile: 119; php: 11; perl: 6; python: 3
file content (28 lines) | stat: -rw-r--r-- 1,116 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Civetweb API Reference

### `mg_get_server_ports( ctx, size, ports );`

### Parameters

| Parameter | Type | Description |
| :--- | :--- | :--- |
|**`ctx`**|`const struct mg_context *`|The context for which the server ports are requested|
|**`size`**|`int`|The size of the buffer to store the port information|
|**`ports`**|`struct mg_server_port *`|Buffer to store the port information|

### Return Value

| Type | Description |
| :--- | :--- |
|`int`|The actual number of ports returned, or an error condition|

### Description

The `mg_get_server_ports()` returns a list with server ports on which the Civetweb server is listening. The ports are returned for a given context and stored with additional information like the SSL and redirection state in a list of structures. The list of structures must be allocated by the calling routine. The size of the structure is also passed to `mg_get_server_ports()`.

The function returns the number of items in the list, or a negative value if an error occurred.

### See Also

* [~~`mg_get_ports();`~~](mg_get_ports.md)
* [`struct mg_server_port;`](mg_server_port.md)