According to the download.file manual the timeout of a connection can be set using options(timeout=10). This seems to work as expected on windows, but on linux the connection does not timeout. I reproduced the problem both 0on R-2.13 on Ubuntu and on R-2.12.1 on CentOS, but not in Windows.> options(timeout=5) > download.file("http://123.123.123.123/bla", dest=tempfile())I am running Ubuntu 11.04 with the R binaries from CRAN:> sessionInfo()R version 2.13.0 (2011-04-13) Platform: i686-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base>-- View this message in context: http://r.789695.n4.nabble.com/linux-connection-never-times-out-tp3662088p3662088.html Sent from the R devel mailing list archive at Nabble.com.
?connections tells us: "Note that this is a timeout for no response, not for the whole operation." And indeed, it will take roughly 20 seconds rather than 60 - at least on the Linux machine I tried it on with R-2.13.1. Best, Uwe Ligges On 12.07.2011 14:24, jeroen00ms wrote:> According to the download.file manual the timeout of a connection can be set > using options(timeout=10). This seems to work as expected on windows, but on > linux the connection does not timeout. I reproduced the problem both 0on > R-2.13 on Ubuntu and on R-2.12.1 on CentOS, but not in Windows. > >> options(timeout=5) >> download.file("http://123.123.123.123/bla", dest=tempfile()) > > I am running Ubuntu 11.04 with the R binaries from CRAN: > >> sessionInfo() > R version 2.13.0 (2011-04-13) > Platform: i686-pc-linux-gnu (32-bit) > > locale: > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 > [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 > [7] LC_PAPER=en_US.UTF-8 LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base >> > > -- > View this message in context: http://r.789695.n4.nabble.com/linux-connection-never-times-out-tp3662088p3662088.html > Sent from the R devel mailing list archive at Nabble.com. > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel
> Can you please verify the behaviour is still the same in a recent R-devel or > at least R-2.13.1? And that there was no other already answered request on > R-help or R-devel re. timeouts?The code below is R 2.13.1. It shows that the timeout time is more than 3 minutes, although it was set to 5 seconds.> options(timeout=5) > system.time(download.file("http://123.123.123.123", dest=tempfile()))trying URL 'http://123.123.123.123' Error in download.file("http://123.123.123.123", dest = tempfile()) : cannot open URL 'http://123.123.123.123' In addition: Warning message: In download.file("http://123.123.123.123", dest = tempfile()) : unable to connect to '123.123.123.123' on port 80. Timing stopped at: 0 0 189.375> sessionInfo()R version 2.13.1 (2011-07-08) Platform: i686-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base>