Sample code for 30+ languages & platforms
Rust

Send HTTPS Get Without Waiting for the Response

See more REST Examples

This example demonstrates sending an HTTP GET request without waiting for the response.

Chilkat Rust Downloads

Rust

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

let rest = chilkat::Rest::new();

// Connect to the server using TLS
let b_auto_reconnect = false;
if rest.connect("example.com", 443, true, b_auto_reconnect).is_err() {
    println!("{}", rest.last_error_text());
    return;
}

// Send a GET request to https://example.com/some/path 
if rest.send_req_no_body("GET", "/some/path").is_err() {
    println!("{}", rest.last_error_text());
    return;
}

// OK, the request was sent.
// Close the connection.
let max_wait_ms = 50;
let _ = rest.disconnect(max_wait_ms);

println!("GET Request Sent.");