error connection to proxy after a tot amount of multi threaded connection
Description
I'm getting the error code " Failed to connect to
session.SetProxies( { { "https", "ip:port" } } );
session.SetProxyAuth( { { "https", cpr::EncodedAuthentication{ "user", "pw" } } } );
session.SetUrl("https://google.com/");
session.Get();
Expected Behavior
for it to not give any errors
Actual Behavior
gives error
Possible Fix
no idea
The issue is, that you are probably using cpr on Windows, right? The error you get lets you know that you used up all free source ports on your system. This might be caused by not properly disposing cpr sessions after use.
To validate this, please try the following. What happens if you run out of ports, then you properly close your application and restart it. In theory Windows should free up all source ports from your application as soon as the process owning them exits.
correct i'm on windows, and yes after closing the process and then reopening it the issue is solved however i'm looking for a better solution. how would i be able to dispose cpr session after use like you mentioned?
One option would be to reuse cpr::Session when ever possible. As soon as you call the destructor of cpr::Session resources should be freed automatically.