MCPcopy Create free account
hub / github.com/boostorg/asio / request

Method request

example/cpp11/socks4/socks4.hpp:32–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30 };
31
32 request(command_type cmd, const boost::asio::ip::tcp::endpoint& endpoint,
33 const std::string& user_id)
34 : version_(version),
35 command_(cmd),
36 user_id_(user_id),
37 null_byte_(0)
38 {
39 // Only IPv4 is supported by the SOCKS 4 protocol.
40 if (endpoint.protocol() != boost::asio::ip::tcp::v4())
41 {
42 throw boost::system::system_error(
43 boost::asio::error::address_family_not_supported);
44 }
45
46 // Convert port number to network byte order.
47 unsigned short port = endpoint.port();
48 port_high_byte_ = (port >> 8) & 0xff;
49 port_low_byte_ = port & 0xff;
50
51 // Save IP address in network byte order.
52 address_ = endpoint.address().to_v4().to_bytes();
53 }
54
55 std::array<boost::asio::const_buffer, 7> buffers() const
56 {

Callers

nothing calls this directly

Calls 3

portMethod · 0.80
protocolMethod · 0.45
addressMethod · 0.45

Tested by

no test coverage detected