LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP client request connection timeout

I need to make a HTTP Post request with a large file. I'd like to have a small timeout (~10s) if the connection doesn't establish and a longer timeout (~60s) if the whole request doesn't complete. 

 

For those familiar with curl, this is analogous to --connect-timeout and --max-time command line options.

 

From https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/vi-lib/httpclient/post-vi.html it seems I can only implement the latter timeout. Is there a way to timeout on connection as well?

 

There's a defer to OS option, does NI Linux expose a way to do this?

 

Regards,

 

David

0 Kudos
Message 1 of 2
(3,079 Views)

I think your best option may be using a HEAD connection first with a short timeout, and then if that succeeds do a POST connection with a long one.

 

Sends a Web request that returns headers from a server, Web page, or Web service. This VI uses the HEAD HTTP method. This VI does not submit any data to the server or receive body data. The minimal data exchange makes the HEAD VI useful for testing the validity of a URL.

 

0 Kudos
Message 2 of 2
(3,059 Views)