MCPcopy Create free account
hub / github.com/Kitware/CMake / create

Method create

Utilities/cmcppdap/src/socket.cpp:91–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89class dap::Socket::Shared : public dap::ReaderWriter {
90 public:
91 static std::shared_ptr<Shared> create(const char* address, const char* port) {
92 init();
93
94 addrinfo hints = {};
95 hints.ai_family = AF_INET;
96 hints.ai_socktype = SOCK_STREAM;
97 hints.ai_protocol = IPPROTO_TCP;
98 hints.ai_flags = AI_PASSIVE;
99
100 addrinfo* info = nullptr;
101 getaddrinfo(address, port, &hints, &info);
102
103 if (info) {
104 auto socket =
105 ::socket(info->ai_family, info->ai_socktype, info->ai_protocol);
106 auto out = std::make_shared<Shared>(info, socket);
107 out->setOptions();
108 return out;
109 }
110
111 term();
112 return nullptr;
113 }
114
115 Shared(SOCKET socket) : info(nullptr), s(socket) {}
116 Shared(addrinfo* info, SOCKET socket) : info(info), s(socket) {}

Callers

nothing calls this directly

Calls 3

initFunction · 0.85
termFunction · 0.85
setOptionsMethod · 0.80

Tested by

no test coverage detected