forked from boostorg/beast
@@ -43,9 +43,9 @@ int main(int argc, char** argv)
|
||||
" websocket-client-sync echo.websocket.org 80 \"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;
|
||||
@@ -58,7 +58,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(), results.begin(), results.end());
|
||||
auto ep = net::connect(ws.next_layer(), 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());
|
||||
|
||||
// Set a decorator to change the User-Agent of the handshake
|
||||
ws.set_option(websocket::stream_base::decorator(
|
||||
|
||||
Reference in New Issue
Block a user