(Swift) Send HTTPS Get Without Waiting for the Response
This example demonstrates sending an HTTP GET request without waiting for the response.
func chilkatTest() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let rest = CkoRest()!
// Connect to the server using TLS
var bAutoReconnect: Bool = false
var success: Bool = rest.connect("example.com", port: 443, tls: true, autoReconnect: bAutoReconnect)
if success == false {
print("\(rest.lastErrorText!)")
return
}
// Send a GET request to https://example.com/some/path
success = rest.sendReqNoBody("GET", uriPath: "/some/path")
if success == false {
print("\(rest.lastErrorText!)")
return
}
// OK, the request was sent.
// Close the connection.
var maxWaitMs: Int = 50
rest.disconnect(maxWaitMs)
print("GET Request Sent.")
}
|