This is what the docs show for URL::InputStreamOptions::withConnectionTimeoutMs
:
InputStreamOptions URL::InputStreamOptions::withConnectionTimeoutMs ( int connectionTimeoutMs ) const
Specifies a timeout for the request in milliseconds.
If 0, this will use whatever default setting the OS chooses.
If a negative number, it will be infinite.
On macOS, this is what happens in juce_mac_Network.mm
when the connection is created before being launched:
void createConnection()
{
jassert (connection == nullptr);
if (NSURL* nsURL = [NSURL URLWithString: juceStringToNS (url.toString (! addParametersToRequestBody))])
{
if (NSMutableURLRequest* req = [NSMutableURLRequest requestWithURL: nsURL
cachePolicy: NSURLRequestReloadIgnoringLocalCacheData
timeoutInterval: timeOutMs <= 0 ? 60.0 : (timeOutMs / 1000.0)])
this is the important part:
timeoutInterval: timeOutMs <= 0 ? 60.0 : (timeOutMs / 1000.0)])
If the user supplies a 0
or negative
value, the timeout is set to 60 seconds, not infinite.
on Windows juce_win32_Network.cpp
, the timeout is set as follows:
void openConnection (URL_COMPONENTS& uc, HINTERNET sessionHandle,
const String& address,
WebInputStream::Listener* listener)
{
int disable = 1;
InternetSetOption (sessionHandle, INTERNET_OPTION_DISABLE_AUTODIAL, &disable, sizeof (disable));
if (timeOutMs == 0)
timeOutMs = 30000;
else if (timeOutMs < 0)
timeOutMs = -1;
Does macOS support infinite timeouts for Web connections?