Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R curl fetch connection problem: time out reached

I've got some problem with the network connection of R.

library(curl)
req <- curl_fetch_memory("https://eu.httpbin.org/get?foo=123")
Error in curl_fetch_memory("https://eu.httpbin.org/get?foo=123") : 
  Timeout was reached: [eu.httpbin.org] Operation timed out after 10002 milliseconds with 0 out of 0 bytes received

I've got no problem when directly access the URL above in Microsoft edge.

httr::GET("http://cran.r-project.org/Rlogo.jpg", config = httr::config(connecttimeout = 60))

And when I specifically set the timeout to be 60 seconds as above, the code ran forever and I had to manually call it back.

> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936 
[2] LC_CTYPE=Chinese (Simplified)_China.936   
[3] LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C                              
[5] LC_TIME=Chinese (Simplified)_China.936    

attached base packages:
[1] stats     graphics  grDevices utils     datasets 
[6] methods   base     

other attached packages:
[1] curl_4.3

loaded via a namespace (and not attached):
[1] compiler_4.0.3 tools_4.0.3   
> curl_version()
$version
[1] "7.64.1"

$ssl_version
[1] "(OpenSSL/1.1.1a) Schannel"

$libz_version
[1] "1.2.11"

$libssh_version
[1] "libssh2/1.8.2"

$libidn_version
[1] NA

$host
[1] "x86_64-w64-mingw32"

$protocols
 [1] "dict"   "file"   "ftp"    "ftps"   "gopher"
 [6] "http"   "https"  "imap"   "imaps"  "ldap"  
[11] "ldaps"  "pop3"   "pop3s"  "rtsp"   "scp"   
[16] "sftp"   "smtp"   "smtps"  "telnet" "tftp"  

$ipv6
[1] TRUE

$http2
[1] FALSE

$idn
[1] TRUE

I've already manually set my DNS to 8.8.8.8. I'm in mainland China and I use VPN to bypass the GFW.

like image 864
LI Shaobai Avatar asked Nov 22 '25 20:11

LI Shaobai


1 Answers

I've solved this problem with reference to this article and by adding :(mylocalhostaddress) to the end of the proxy. Hope it helps somebody in the future. Thank you, guys.

like image 120
LI Shaobai Avatar answered Nov 24 '25 14:11

LI Shaobai



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!