ARES_SET_SOCKET_CALLBACK(3)
β¨ NAME β¨
okay bestie, welcome to the ARES_SET_SOCKET_CALLBACK(3) page in the Library Functions Manual π β this one is all about ares_set_socket_callback, aka Set a socket creation callback. Thatβs the name, thatβs the vibe, periodt. π
πΈ SYNOPSIS πΈ
#include <ares.h>
typedef int (*ares_sock_create_callback)(ares_socket_t socket_fd,
int type,
void *userdata)
void ares_set_socket_callback(ares_channel_t *channel,
ares_sock_create_callback callback,
void *userdata)
cc file.c -lcares
π¦ DESCRIPTION π¦
okay so hereβs the tea β: ares_set_socket_callback() sets a callback in the given ares channel handle. That callback function gets invoked after the socket has been created, and connected to the remote server. No cap. β¨
The callback must return ARES_SUCCESS if things are fine, or return -1 to signal an error. A returned error will abort the ares operation β dramatic, but thatβs literally what it does. π
π¨ real talk: the callback is invoked while c-ares is part-way through opening a connection. It must not call any c-ares function on the same channel; see ares_set_socket_functions(3) for the related lore. π
π SEE ALSO π
π AVAILABILITY π
ares_set_socket_callback(3) was added in c-ares 1.6.0. iconic behavior from way back π«Άβ¨
bye bestie π β this page is dated 20 Nov 2009, footer-stamped ARES_SET_SOCKET_CALLBACK(3), and living in the Library Functions Manual. The c-ares 1.6.0 availability deets stay above. π
π
π¦ where this page comes from
- alpine 3.22: c-ares-doc 1.34.9-r0 Β· MIT
- alpine 3.23: c-ares-doc 1.34.9-r0 Β· MIT
- alpine 3.24: c-ares-doc 1.34.9-r0 Β· MIT
- arch rolling: c-ares 1.34.9-1 Β· MIT
- centos-stream 10: c-ares-devel 1.34.9-1.el10 Β· MIT
- nixos 26.05: c-ares 1.34.9
- π the page's license: MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms