Search code examples
c++sslwebsocketclientpoco-libraries

Looking for poco ssl websocket client example in C++ for Windows 7


I've been looking through the poco samples and documentation, but I couldn't find out how to use poco's websockets and SSL combined. I successfully connected a non-SSL websocket (based on the WebSocket class) to a server (the echoserver sample from Qt5.4, running on Ubuntu), but how to add SSL to the client eludes me. Poco's NetSSL_OpenSSL samples aren't all that helpful, because I don't need to know how to download, tweet, mail or write a time server. Also the latter is the only one that uses "SecureStreamSocket" objects at all (which is probably the class I need). But that sample just accesses the socket from the request object, it doesn't show how to create and configure one properly.

I just want an SSL websocket client to send and receive some simple messages, like "Hello World". Can anyone help me please?

I use Windows 7 64 Bit for the client's OS and Ubuntu 64 Bit on VirtualBox for the server's OS, but the server side is no problem. My poco version is 1.6.0 and I compiled it with Visual Studio 2013 Express. Also I use OpenSSL 1.0.1j.

Cheers

Alex


Solution

  • Look at WebSocket testcase. Use HTTPSClientSession (instead of HTTPClientSession).