Overview
Features
Download
Documentation
Community
Add-Ons & Services

SecureServerSocket sample

Please post support and help requests here.
flomll
Posts: 28
Joined: 18 May 2012, 08:58
Location: Austria

SecureServerSocket sample

Postby flomll » 05 Nov 2012, 11:17

Hy I would like to write a multithreaded SSL server. So I started with the EchoServer sample and modify something to use the SecureServerSocket instead of ServerSocket.

The code compiles and start to execute but I get a SSL Exception: Configuration error: no certificate file has been specified. How or where can I set the path to the certificate?

Here is a part of my code: (At line ?? the SSL Exception is thrown.)

Code: Select all

int main(const std::vector<std::string>& args)
{
   if (_helpRequested)
   {
      displayHelp();
   }
   else
   {
      // get parameters from configuration file
      unsigned short port = (unsigned short) config().getInt("EchoServer.port", 9977);

      // set-up a server socket
      SecureServerSocket svs(port);

      // set-up a SocketReactor...
      SocketReactor reactor;
      // ... and a SocketAcceptor
      SocketAcceptor<SecureEchoServiceHandler> acceptor(svs, reactor);
      // run the reactor in its own thread so that we can wait for
      // a termination request
      Thread thread;
      thread.start(reactor);
      // wait for CTRL-C or kill
      waitForTerminationRequest();
      // Stop the SocketReactor
      reactor.stop();
      thread.join();
   }
   return Application::EXIT_OK;
}


At the constructor of the ServerApplication class I execute

Code: Select all

Poco::Net::initializeSSL();
and at the destructor

Code: Select all

Poco::Net::uninitializeSSL();


Can anyone help me with that problem? Does anyone have a sample project that implements a multithreaded SSL server with POCO?

flomll
Posts: 28
Joined: 18 May 2012, 08:58
Location: Austria

Re: SecureServerSocket sample

Postby flomll » 05 Nov 2012, 15:45

I fixed the problem. The only thing you have to to do is at the HTTPSTimeServerSample. To test the implementation use the certificate from the HTTPSTimeServerSample and the *.properties file. At this file you can finde some sample entries to configure the openssl configurations.

If anyone need the simple code for SecureEchoServerSample, write me!!


Return to “Support”

Who is online

Users browsing this forum: No registered users and 3 guests

cron