1/*
2 * IXSocketConnect.h
3 * Author: Benjamin Sergeant
4 * Copyright (c) 2018 Machine Zone, Inc. All rights reserved.
5 */
6
7#pragma once
8
9#include "IXCancellationRequest.h"
10#include <string>
11
12struct addrinfo;
13
14namespace ix
15{
16 class SocketConnect
17 {
18 public:
19 static int connect(const std::string& hostname,
20 int port,
21 std::string& errMsg,
22 const CancellationRequest& isCancellationRequested);
23
24 static void configure(int sockfd);
25
26 private:
27 static int connectToAddress(const struct addrinfo* address,
28 std::string& errMsg,
29 const CancellationRequest& isCancellationRequested);
30 };
31} // namespace ix
32