Specify which documentation you found a problem with
CURLMOPT_SOCKETFUNCTION (https://curl.se/libcurl/c/CURLMOPT_SOCKETFUNCTION.html)
The problem
The callback for CURLMOPT_SOCKETFUNCTION receives two application-supplied data pointers, named clientp and socketp. The documentation says that clientp is set with CURLMOPT_SOCKETDATA and socketp is set with curl_multi_assign().
The example code does not use curl_multi_assign(), but its callback function uses socketp (called sockp in the function) to get the struct priv pointer instead of clientp (cbp) as I would expect.