forked from boostorg/beast
@@ -47,9 +47,9 @@ int main(int argc, char** argv)
|
||||
" websocket-client-sync-ssl echo.websocket.org 443 \"Hello, world!\"\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
auto const host = argv[1];
|
||||
auto const port = argv[2];
|
||||
auto const text = argv[3];
|
||||
std::string host = argv[1];
|
||||
auto const port = argv[2];
|
||||
auto const text = argv[3];
|
||||
|
||||
// The io_context is required for all I/O
|
||||
net::io_context ioc;
|
||||
@@ -68,7 +68,12 @@ int main(int argc, char** argv)
|
||||
auto const results = resolver.resolve(host, port);
|
||||
|
||||
// Make the connection on the IP address we get from a lookup
|
||||
net::connect(ws.next_layer().next_layer(), results.begin(), results.end());
|
||||
auto ep = net::connect(get_lowest_layer(ws), results);
|
||||
|
||||
// Update the host_ string. This will provide the value of the
|
||||
// Host HTTP header during the WebSocket handshake.
|
||||
// See https://tools.ietf.org/html/rfc7230#section-5.4
|
||||
host += ':' + std::to_string(ep.port());
|
||||
|
||||
// Perform the SSL handshake
|
||||
ws.next_layer().handshake(ssl::stream_base::client);
|
||||
|
||||
Reference in New Issue
Block a user