[R] RCurl - curlPerform - Time out?!?

Duncan Temple Lang dtemplelang at ucdavis.edu
Wed Oct 31 00:18:54 CET 2012


Hi Florian

 Yes, there are several options for a curl operation that control the timeout.
The timeout option is the top-level general one.  There is also timeout.ms.
You can also control the timeout length for different parts of the operation/request
such as via the connecttimeout for just establishing the connection.
See the Connection Options in the libcurl help page for curl_easy_setopt.

  Best,
   D.


On 10/30/12 9:30 AM, Florian Umlauf (CRIE) wrote:
> 
> 
> Hi,
> 
> I am working with the RCurl package and I am using the curlPerform 
> function for an soap-query.
> The problem is that the code is usually working well, but sometimes the 
> connection gets lost.
> 
> So I wrote a while-loop to repeat the query if anything might happened 
> so that the same query runs again, but if the query-faults it takes a 
> very long time for the repetition.
> 
> My question is if there is any possibility to force a time out for the 
> curlPerform function or something like that?
> 
> 
> Thanks!
> 
> 
> 
>              run = 1
>              i=0
>              while(run==1)
>                  {
>                      i=i+1
>                      try    (
>                                               run <- curlPerform(url = 
> "http://search.webofknowledge.com/esti/wokmws/ws/WokSearchLite.cgi",
> httpheader=c("Accept-Encoding"="gzip,deflate","Content-Type"="text/xml;charset=UTF-8",'SOAPAction'='""',
> "Cookie"=paste('SID="',s_session,'"',sep=""),"Content-Length"=paste(nchar(s_body)),"Host"="search.webofknowledge.com","Connection"="Keep-Alive","User-Agent"="Apache-HttpClient/4.1.1 
> (java 1.5)"),
> postfields=s_body,
> writefunction = h$update
>                                                              ,verbose = 
> TRUE)
>                           ,TRUE)
> 
> 
>                      print(i)
>                   }
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
>




More information about the R-help mailing list