.. _program_listing_file_sockets_socket_headers.hpp: Program Listing for File socket_headers.hpp =========================================== |exhale_lsh| :ref:`Return to documentation for file ` (``sockets/socket_headers.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #pragma once #include #include #ifdef _WIN32 #include #include #else #include #include #include #include #include #endif namespace c2k::constants { #ifdef _WIN32 inline constexpr auto invalid_socket = std::uintptr_t{ INVALID_SOCKET }; inline constexpr auto socket_error = SOCKET_ERROR; inline constexpr auto reuse_port = SO_REUSEADDR; inline constexpr auto tcp_no_delay = TCP_NODELAY; inline constexpr auto send_flags = 0; using SockLen = int; using SendReceiveSize = int; #else inline constexpr auto invalid_socket = -1; inline constexpr auto socket_error = -1; inline constexpr auto reuse_port = SO_REUSEPORT; inline constexpr auto tcp_no_delay = TCP_NODELAY; inline constexpr auto send_flags = MSG_NOSIGNAL; using SockLen = unsigned int; using SendReceiveSize = std::size_t; #endif } // namespace c2k::constants #ifndef _WIN32 inline int closesocket(int const socket) { return close(socket); } #endif