- Code: Select all
std::string privateKey = config().getString( "Connection.privateKeyFile", "any.pem" );
std::string caLocation = config().getString( "Connection.caLocationFile", "rootcert.pem" );
SharedPtrptrConsole = new KeyAcceptHandler( false );
SharedPtrptrCert = new AcceptCertificateHandler( false );
SharedPtrptrContext = new Context( privateKey, caLocation, false, Context::VERIFY_NONE );
SSLManager::instance().initializeClient( ptrConsole, ptrCert, ptrContext );
ptrConsole = new KeyAcceptHandler( true );
ptrCert = new AcceptCertificateHandler( true );
ptrContext = new Context( privateKey, caLocation, true, Context::VERIFY_NONE );
SSLManager::instance().initializeServer( ptrConsole, ptrCert, ptrContext );
std::string sip = config().getString( "Connection.ip_https", "*" );
unsigned short sport = (unsigned short)config().getInt( "Connection.port_https", 443 );
HttpsProtocol sprot;
SocketAddress saddr( sip, sport );
SecureServerSocket ssvs( saddr );
TCPServerParams* httpsParam = new TCPServerParams;
httpsParam->setMaxQueued( 256 );
httpsParam->setMaxThreads( threads/2 );
httpsParam->setThreadPriority( Poco::Thread::PRIO_HIGH );
ThreadPool shttpPool( "HTTPS", threads/20, threads/2, 60 );
TCPServer ssrv( new ServerFactory( sprot ),
shttpPool,
ssvs,
httpsParam );
if( config().getString( "Connection.ip_https", "" ) != "" )
ssrv.start();
Now I need to open a second or more SSL Connections, so I try to duplicate the code (changing variables name, certified, port and using each new connection to a new virtual IP) to each new connection, but only the first connection works, the others always failed.
Is it possible to open more then one SSL Connection with Poco? If yes, how?
If not possible, I know how to do it with OpenSSL, but the return I have is a char string. How can I use that string received with OpenSSL to my ServerFactory, without need to make a program only to receive the connection and make a tunnel to my already working program?





