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

1

6

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

Slavocracy answered 27/2, 2015 at 17:26 Comment(6)
Oh, come ON! 2 downvotes just 1 minute after posting? If there's a problem with this question, just say so. Hit&run is not helpful at all. I did go through Poco's documentation, but it's just lacking in that specific case.Slavocracy
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.Ebony
Really? How can a Hello World program attract opinionated answers? I mean it's not like there are all that many possibilities on how to do it. And how can asking for a tutorial attract opinionated answers if the total amount of tutorials I found until now is zero? I just want to know how to use those classes correctly and the function descriptions in the Poco docs aren't enough as they don't tell you what to do in which order and what to look out for.Slavocracy
Asking for code, without showing what you have tried yourself is off topic as well.Ebony
He said he's looked at the sample programs and can't figure out how to make them work. That IS what he's done. This sort of stupid gut-reaction downvoting is part of what makes SO so useless so much of the time.Chico
@Chico I wouldn't say that it happens often, but it did happen to me a few times, because I tend to have difficult questions that look noobish. My only complaint about this is the no-comment-down-voting, because if I do something wrong I'd like to learn from it. Btw: I ended up leaving POCO after all, because the example code I created (see below) required me to have a main function, but I wanted to use POCO from inside my dll, so my main function is in C#. I ended up using IP Sockets with OpenSSL, which has its own challenges but it all worked out in the end.Slavocracy
S
6

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

Slavocracy answered 1/3, 2015 at 16:12 Comment(4)
Thanks for all the help in the POCO forum. I put my complete solution at the end of that thread.Slavocracy
They don't have websocket ssl classes? Only using client argument in the constructor of websocket will enable websocket on ssl?Appetizer
The link above is dead, can you provide another?Laughable
Wow, I did not expect the forum to go down, unless POCO were to go down, too. Thank goodness there's archive.org. Here are Page 1 and Page 2.Slavocracy

© 2022 - 2024 — McMap. All rights reserved.