MCPcopy Create free account
hub / github.com/PABannier/bark.cpp / create_server_socket

Method create_server_socket

examples/server/httplib.h:6112–6126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6110}
6111
6112inline socket_t
6113Server::create_server_socket(const std::string &host, int port,
6114 int socket_flags,
6115 SocketOptions socket_options) const {
6116 return detail::create_socket(
6117 host, std::string(), port, address_family_, socket_flags, tcp_nodelay_,
6118 std::move(socket_options),
6119 [](socket_t sock, struct addrinfo &ai) -> bool {
6120 if (::bind(sock, ai.ai_addr, static_cast<socklen_t>(ai.ai_addrlen))) {
6121 return false;
6122 }
6123 if (::listen(sock, CPPHTTPLIB_LISTEN_BACKLOG)) { return false; }
6124 return true;
6125 });
6126}
6127
6128inline int Server::bind_internal(const std::string &host, int port,
6129 int socket_flags) {

Callers

nothing calls this directly

Calls 2

create_socketFunction · 0.85
stringFunction · 0.85

Tested by

no test coverage detected