get_peername()#
get_peername() retrieves the peer’s address and stores it in the provided buffer.
Prototype
int get_peername(
char *bf,
size_t bfsize,
int fd
);
Parameters
Key |
Type |
Description |
|---|---|---|
|
|
Buffer to store the peer’s address. |
|
|
Size of the buffer to ensure safe storage. |
|
|
File descriptor of the socket whose peer address is retrieved. |
Return Value
Returns 0 on success, or -1 on failure.
Notes
This function internally calls getpeername() to obtain the peer’s address.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples