Sample code for 30+ languages & platforms
Tcl

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 Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

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

set rest [new_CkRest]

# Connect to the server using TLS
set bAutoReconnect 0
set success [CkRest_Connect $rest "example.com" 443 1 $bAutoReconnect]
if {$success == 0} then {
    puts [CkRest_lastErrorText $rest]
    delete_CkRest $rest
    exit
}

# Send a GET request to https://example.com/some/path 
set success [CkRest_SendReqNoBody $rest "GET" "/some/path"]
if {$success == 0} then {
    puts [CkRest_lastErrorText $rest]
    delete_CkRest $rest
    exit
}

# OK, the request was sent.
# Close the connection.
set maxWaitMs 50
CkRest_Disconnect $rest $maxWaitMs

puts "GET Request Sent."

delete_CkRest $rest