aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/tls_client.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-11-07 15:48:17 +0000
committerlloyd <[email protected]>2012-11-07 15:48:17 +0000
commit36a5aaced4bf474514bf32d284b63bc5c3067978 (patch)
treedee60ac810a50c3f79998de06c09ca3e846944db /doc/examples/tls_client.cpp
parent9edb16ec3bb572bad5e51582dab5efea73c4fe14 (diff)
Offer DTLS if connecting over UDP
Diffstat (limited to 'doc/examples/tls_client.cpp')
-rw-r--r--doc/examples/tls_client.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/examples/tls_client.cpp b/doc/examples/tls_client.cpp
index a9efe21e1..82c8910f3 100644
--- a/doc/examples/tls_client.cpp
+++ b/doc/examples/tls_client.cpp
@@ -161,6 +161,11 @@ int main(int argc, char* argv[])
std::bind(stream_socket_write, sockfd, _1, _2) :
std::bind(dgram_socket_write, sockfd, _1, _2);
+ auto version =
+ (transport == "tcp") ?
+ TLS::Protocol_Version::latest_tls_version() :
+ TLS::Protocol_Version::latest_dtls_version();
+
TLS::Client client(socket_write,
process_data,
handshake_complete,
@@ -169,6 +174,7 @@ int main(int argc, char* argv[])
policy,
rng,
TLS::Server_Information(host, port),
+ version,
protocol_chooser);
while(!client.is_closed())