Add-Ons & Services

TCPServer SecureStreamSocket

Please post support and help requests here.
Posts: 2
Joined: 20 Feb 2014, 02:01

TCPServer SecureStreamSocket

Postby RtBower » 20 Feb 2014, 07:13

I'm new to Poco and have a few questions. I'm using Poco::TCPServer in a custom gateway, passing many client requests (slightly modified) to one external server whose responses get reflected back to each client. Both client and external server interfaces require SSL.

My first question is about binding SSL to the "listener" socket. I realize I can use the SecureStreamSocket::attach(), but I'm not sure where. Is the class using TCP sessions (Virtual Circuits)? Should I do the attach on the single socket in my implementation of the myServerApplication or each instance of myTCPServerConnection?

My second question regards opening secure sockets to the external server. Again, I could do this in myTCPServerConnection, but it seems a waist to go through handshaking for every request; especially when there's only one external server. I had a thought about overriding the TCPServer's thread spawning to add a socket there that can be reused. Any ideas how this could be efficiently implemented?

I had no luck finding anything similar in example code, discussions in this forum, or in a Google search. I'm just not sure if I'm on the right track. Comments and advice from the Poco community is much appreciated.

Thanks in advance, Rt_Bower

Posts: 2
Joined: 20 Feb 2014, 02:01

Re: TCPServer SecureStreamSocket

Postby RtBower » 20 Feb 2014, 18:27

Ok, I already have the answer to my first question. To use SSL in the TCPServer, simply add SSL initialization and context, then replace the listener socket with Poco::SecureServerSocket in your main ServerApplication startup. This worked perfectly for all connected clients.

I still would like to hear opinions about an efficient way to reuse secure sockets when communicating with the external server.

Return to “Support”

Who is online

Users browsing this forum: No registered users and 1 guest