(Objective-C) Send HTTPS Get Without Waiting for the Response
This example demonstrates sending an HTTP GET request without waiting for the response.
#import <CkoRest.h>
// 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;
BOOL 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.");
|