c++ - Boost::asio::endpoint::size() and resize() -
itemprop = "text">
I was reading the end point document and saw size () and size (member) calls the funcs documentation: native type The original size of the endpoint is found. What does this shape reflect and how can it be used / re-shaped? Thank you.
As a docs state, a boost :: asio :: ip :: basic_endpoint < / Code> is an object which:
describes an endpoint for a version-independent IP socket.
In this case, the "endpoint" for an IP address and port and depending on the protocol you are using, the endpoint (" The "original" representation of "the" original "representation" used by the OS for the lower-level socket API) may differ, so the basic point
acts as a cover for the original end point type.
Resize your question to size ()
and ()
actually, I think the interval endpoint achieves the size of the representation Apart from serving as a portable way for, I think the answer is "not much".
On the system like Unix (sorry, I do not have any details for Windows): The built-in endpoint type is usually the struct sockaddr_in
for IPv4 and Struct sockaddr_in6
for IPv6 (defined in netinet / in.h
). Therefore, size ()
sizeof
will return one of the compositions, depending on how the basic point
was created. For more information on sockaddr
family, see here:
In fact, the code for size ()
is surprisingly simple if you ~ boost / asio / ip / basic_endpoint.hpp
in line 180). It only calls a typedef
at sizeof
, for example the protocol represents the underlying origin endpoint type. The interesting thing is that the resizing ()
method does too much nothing , in addition to leaving an exception, if the requested size is in the underlying sockaddr_storage
is a composition in which there is sufficient storage space for either sockaddr_in
or sockaddr_in6
) It is present in future to be used for future use in ASEO or future protocol, because is the default point
is a template class. I'm not really sure ...
Why do you want to use these methods of a final point in day programming every day, I really can not think of a reason.
Comments
Post a Comment