Sample code for 30+ languages & platforms
Objective-C

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 Objective-C Downloads

Objective-C
#import <CkoRest.h>

BOOL success = NO;

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

CkoRest *rest = [[CkoRest alloc] init];

// Connect to the server using TLS
BOOL bAutoReconnect = NO;
success = [rest Connect: @"example.com" port: [NSNumber numberWithInt: 443] tls: YES autoReconnect: bAutoReconnect];
if (success == NO) {
    NSLog(@"%@",rest.LastErrorText);
    return;
}

// Send a GET request to https://example.com/some/path 
success = [rest SendReqNoBody: @"GET" uriPath: @"/some/path"];
if (success == NO) {
    NSLog(@"%@",rest.LastErrorText);
    return;
}

// OK, the request was sent.
// Close the connection.
int maxWaitMs = 50;
[rest Disconnect: [NSNumber numberWithInt: maxWaitMs]];

NSLog(@"%@",@"GET Request Sent.");