MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / beginSocketConnection

Method beginSocketConnection

Libraries/Http/HttpAsyncClient.cpp:255–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253{
254 char addressBuffer[256];
255 Span<char> ipAddress = {addressBuffer};
256 SC_TRY(SocketDNS::resolveDNS(currentURL.hostname, ipAddress));
257
258 SocketIPAddress remoteAddress;
259 SC_TRY(remoteAddress.fromAddressPort({ipAddress, true, StringEncoding::Ascii}, currentURL.port));
260 SC_TRY(eventLoop->createAsyncTCPSocket(remoteAddress.getAddressFamily(), connection->socket));
261
262 state = State::Connecting;
263 return connectAsync.start(*eventLoop, connection->socket, remoteAddress);
264}
265
266void HttpAsyncClient::onConnected(AsyncSocketConnect::Result& result)
267{
268 if (not result.isValid())
269 {
270 fail(result.isValid());

Callers

nothing calls this directly

Calls 3

createAsyncTCPSocketMethod · 0.80
getAddressFamilyMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected