Pong
June 9th 2014, SSL Client/Server Application
← June 9th 2014 SSL Client with QSslSocket | ● | June 10th 2014 SSL Server Connection Factory →
Now we put the SSL client and server classes together to be run as a single application:
int main(int argc, char **argv)
{
QApplication app(argc, argv);
if (argc <= 1)
{
SSLServer server;
server.start("cert.pem", "key.pem", 10000);
return(app.exec());
}
else
{
SSLClient client;
client.start(argv[1], 10000);
}
return(0);
}
{
QApplication app(argc, argv);
if (argc <= 1)
{
SSLServer server;
server.start("cert.pem", "key.pem", 10000);
return(app.exec());
}
else
{
SSLClient client;
client.start(argv[1], 10000);
}
return(0);
}
Usage of the above application:
- The application will act as SSL server listening on port 10000 when started /wo arguments.
- It will act as SSL client when started with the server’s address as argument, for example “localhost” or 127.0.0.1.
← June 9th 2014 SSL Client with QSslSocket | ● | June 10th 2014 SSL Server Connection Factory →