curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder Daniel himself.

Max connections per peer / IP

From: Patrick Schlangen via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 30 Oct 2025 14:05:18 +0000

Hi,

I've been looking for a way to have something like CURLMOPT_MAX_HOST_CONNECTIONS - but instead of limiting by hostname:port, limit by peer / IP address.

It seems it's not straightforward to add this in a way similar to CURLMOPT_MAX_HOST_CONNECTIONS since that limit seem to be checked before the address resolution has been done.

Another idea I had was trying to use CURLOPT_OPENSOCKETFUNCTION and introduce some kind of special return value (like CURL_SOCKET_BAD) which causes the connection to be put in pending state, and have libcurl retry the socket creation later. That could also be useful for implementing other custom ways of limiting connections, or to retry socket creation if the system (or application) runs out of sockets.

Any thoughts on this? Maybe I'm missing some way in which this can already be implemented right now without changes to libcurl?

Thanks,

Patrick
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2025-10-30