Change mg_straddr() API

This commit is contained in:
Sergey Lyubka committed 2022-01-05 19:09:11 +00:00
1 parent ff811f287a
commit fc3c08e411
6 files changed
+24 -32

No files matched your search

+4 -4
View File
@@ -628,13 +628,13 @@ void foo(struct mg_connection *c, const char *fmt, ...) {
### mg\_straddr
```c
char *mg_straddr(struct mg_connection *c, char *buf, size_t len);
char *mg_straddr(struct mg_addr *addr, char *buf, size_t len);
```
Write stringified IP address, associated with given connection to `buf` (maximum size `len`)
Parameters:
- `c` - A connection pointer
- `addr` - A address pointer
- `buf` - A pointer to a buffer that will hold stringified address
- `len` - A buffer size
@@ -643,8 +643,8 @@ Return value: `buf` value
Usage example:
```c
char buf[1024];
mg_straddr(c, buf, sizeof(buf)); // `buf` is now IP address string, like "127.0.0.1:8080"
char buf[100];
LOG(LL_INFO, ("%s", mg_straddr(&c->peer, buf, sizeof(buf))));
```
### mg\_mkpipe()