/workspaces/astro/sol3-sdk/cpp/sol3/net/tcp_socket.h Source File

Space-ng SDK: /workspaces/astro/sol3-sdk/cpp/sol3/net/tcp_socket.h Source File
Space-ng SDK
tcp_socket.h
Go to the documentation of this file.
1 // Copyright (c) Space-ng, inc. All rights reserved.
2 
3 #pragma once
4 
5 #include "sol3/net/msg/tcp_socket_config.h"
6 
7 #include <boost/asio/ip/tcp.hpp>
8 
9 namespace sol3::net {
10 
11 // Configuration for a TCP socket
13  // Sets TCP_NODELAY
14  bool tcp_no_delay{true};
15 
16  // Sets SO_REUSEADDR
17  bool reuse_address{true};
18 
19  // Sets SO_RCVBUF if > 0, otherwise default.
20  int so_rcvbuf{-1};
21 
22  // Sets SO_SNDBUF if > 0, otherwise default.
23  int so_sndbuf{-1};
24 };
25 
27  boost::asio::ip::tcp::socket& s, msg::TcpSocketConfigT const& config);
28 
29 // Returns the number of bytes waiting in the kernel send buffer.
30 // Returns -1 if not supported or if the call fails.
31 int32_t getKernelSendQueueSize(boost::asio::ip::tcp::socket& s);
32 
33 } // namespace sol3::net
Definition: buffer_pool.h:12
int32_t getKernelSendQueueSize(boost::asio::ip::tcp::socket &s)
void applySocketOpts(boost::asio::ip::tcp::socket &s, msg::TcpSocketConfigT const &config)
Definition: tcp_socket.h:12
int so_rcvbuf
Definition: tcp_socket.h:20
bool tcp_no_delay
Definition: tcp_socket.h:14
bool reuse_address
Definition: tcp_socket.h:17
int so_sndbuf
Definition: tcp_socket.h:23