get_sockname()
#
get_sockname()
retrieves the local socket address associated with the given file descriptor and stores it as a string.
Prototype
int get_sockname(
char *bf,
size_t bfsize,
int fd
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
Buffer to store the local socket address as a string. |
|
|
Size of the buffer |
|
|
File descriptor of the socket whose local address is to be retrieved. |
Return Value
Returns 0
on success, or -1
on failure.
Notes
This function is useful for obtaining the local address of a socket, particularly in network applications.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples