QTcpServer Base class
-
Hello,
I'm creating an http server who can handle ssl or non ssl connections (boolean in the constructor) and I wanted to use either QTcpServer or SSLServer (class created by myself which inherits from QTcpServer) without changing my code
So let's admit I have to do nextPendingConnection(); I don't want to do this :
if(m_ssl){ socket = dynamic_cast<SSLServer*>(m_tcpServer)->nextPendingConnection(); }else{ socket = m_tcpServer->nextPendingConnection(); }
but only m_tcpServer->nextPendingConnection(); and get the right type (either QTcpSocket or QSslSocket)
So actually I think it's possible because I use functions existing in both classes but I don't know how to do achieve this.
Thank you !
-
@moffa13 said:
QTcpSocket or QSslSocke
but does QSslSocket not inherited QTcpSocket ?
So if socket is
QTcpSocket *socketit could point to a QSslSocke also and the correct nextPendingConnection() would be called
pr normal resolve?