MCPcopy Create free account
hub / github.com/chrxh/alien / create_server_socket

Method create_server_socket

external/cpp-httplib/httplib.h:5369–5382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5367 }
5368
5369 inline socket_t
5370 Server::create_server_socket(const char* host, int port, int socket_flags,
5371 SocketOptions socket_options) const {
5372 return detail::create_socket(
5373 host, "", port, address_family_, socket_flags, tcp_nodelay_,
5374 std::move(socket_options),
5375 [](socket_t sock, struct addrinfo& ai) -> bool {
5376 if (::bind(sock, ai.ai_addr, static_cast<socklen_t>(ai.ai_addrlen))) {
5377 return false;
5378 }
5379 if (::listen(sock, CPPHTTPLIB_LISTEN_BACKLOG)) { return false; }
5380 return true;
5381 });
5382 }
5383
5384 inline int Server::bind_internal(const char* host, int port, int socket_flags) {
5385 if (!is_valid()) { return -1; }

Callers

nothing calls this directly

Calls 1

create_socketFunction · 0.85

Tested by

no test coverage detected