Hello, I have been successfully using ASIO for a long time, but recently I try to use SSL over SOCKS 4 and I'm struggling with short read while asynchronous SSL handshaking. I have come across this: http://stackoverflow.com/questions/9943541/boost-asio-how-to-read-write-on-a-ssl-socket-that-doesnt-use-ssl?rq=1][1], but it's only partially helpful. I haven't find any good explanation, what the layers really are (ex. I can't assign next_layer and lowest_layer to any of OSI layers). Could someone explain the meaning of next_layer and lowest_layer and how to use SSL stream with SOCKS 4 proxy. Best regards, Maciej Miszczak
On 09/16/2014 09:36 AM, Maciej Miszczak wrote:
lowest_layer to any of OSI layers). Could someone explain the meaning of next_layer and lowest_layer
As you already have inferred, these "layers" have nothing to do with the OSI model. They refer to types in an inheritance chain; actually, that is not necessarily true in the general case, but it is an adequate approximation for understanding them. lowest_layer() returns a reference to a basic_socket<>, which is the base class for both basic_stream_socket<> (ip::tcp::socket) and basic_datagram_socket<> (ip::udp::socket), so you can only use functions that they have in common. next_layer() returns a reference to the socket type that you have wrapped. For ssl::streamip::tcp::socket it returns ip::tcp::socket&.
Thank you, Bjorn, for the explanation. Fortunately I managed to make it work, but I will do some further research to explore the ASIO deeper and understand it better. Cheers, Maciej
participants (2)
-
Bjorn Reese
-
Maciej Miszczak