diff options
Diffstat (limited to 'doc/examples/tls_server.cpp')
-rw-r--r-- | doc/examples/tls_server.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/doc/examples/tls_server.cpp b/doc/examples/tls_server.cpp index da13953f8..153b26d04 100644 --- a/doc/examples/tls_server.cpp +++ b/doc/examples/tls_server.cpp @@ -1,17 +1,12 @@ -/* -* (C) 2008-2010 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - #include <botan/botan.h> #include <botan/tls_server.h> -#include <botan/unx_sock.h> #include <botan/rsa.h> #include <botan/dsa.h> #include <botan/x509self.h> +#include "socket.h" + using namespace Botan; #include <stdio.h> @@ -34,9 +29,9 @@ class Server_TLS_Policy : public TLS_Policy return true; } }; + int main(int argc, char* argv[]) { - int port = 4433; if(argc == 2) @@ -44,7 +39,8 @@ int main(int argc, char* argv[]) try { - LibraryInitializer init; + LibraryInitializer botan_init; + SocketInitializer socket_init; AutoSeeded_RNG rng; @@ -57,7 +53,7 @@ int main(int argc, char* argv[]) X509_Certificate cert = X509::create_self_signed_cert(options, key, "SHA-1", rng); - Unix_Server_Socket listener(port); + Server_Socket listener(port); Server_TLS_Policy policy; @@ -86,12 +82,12 @@ int main(int argc, char* argv[]) printf("Writing some text\n"); char msg[] = "Foo\nBar\nBaz\nQuux\n"; - tls.write((const byte*)msg, strlen(msg)); + tls.write((const Botan::byte*)msg, strlen(msg)); printf("Now trying a read...\n"); char buf[1024] = { 0 }; - u32bit got = tls.read((byte*)buf, sizeof(buf)-1); + u32bit got = tls.read((Botan::byte*)buf, sizeof(buf)-1); printf("%d: '%s'\n", got, buf); tls.close(); |