Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, December 2007
QSslSocket samples


Message 1 in thread

hello,
anybody knows any places I can find samples for QSslSocket ?
thanks.

--
 [ signature omitted ] 

Message 2 in thread

Yong Taro wrote:

> hello,
> anybody knows any places I can find samples for QSslSocket ?

It's exactly the same as the QTcpSocket except that you must remember to
start encryption before you send data down it.  Assistant actually has good
documentation on what you should do.

A

--
 [ signature omitted ] 

Message 3 in thread

Basically what I'm interested in more is if I can create a QSslSocket 
out of a QTcpSocket.
The idea is as follows:
QTcpSocket* tcpSocket = QTcpServer::nextPendingConnection();
(A) - QSslSocket sslSocket( tcpSocket );
or
(B) - QSslSocket sslSocket;
(B) - sslSocket.setDescriptor( tcpSocket ->socketDescriptor() );

but I'm afraid I have to do that at earlier level like
void QTcpServer::incomingConnection ( int socketDescriptor )   [virtual 
protected]

because
bool QAbstractSocket::setSocketDescriptor ( int socketDescriptor, 
SocketState socketState = ConnectedState, OpenMode openMode = ReadWrite )
---->>>It is not possible to initialize two abstract sockets with the 
same native socket descriptor.


Is (B) possible ?


Adam Hawes wrote:
> Yong Taro wrote:
>
>   
>> hello,
>> anybody knows any places I can find samples for QSslSocket ?
>>     
>
> It's exactly the same as the QTcpSocket except that you must remember to
> start encryption before you send data down it.  Assistant actually has good
> documentation on what you should do.
>
> A
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
>   

--
 [ signature omitted ] 

Message 4 in thread

Yong Taro wrote:
>Basically what I'm interested in more is if I can create a QSslSocket
>out of a QTcpSocket.

No.

>The idea is as follows:
>QTcpSocket* tcpSocket = QTcpServer::nextPendingConnection();
>(A) - QSslSocket sslSocket( tcpSocket );

Not possible.

>or
>(B) - QSslSocket sslSocket;
>(B) - sslSocket.setDescriptor( tcpSocket ->socketDescriptor() );

Not possible either.

>but I'm afraid I have to do that at earlier level like
>void QTcpServer::incomingConnection ( int socketDescriptor )   [virtual
>protected]

This is how we recommend you implement a QTcpServer that returns 
QSslSocket objects.

>because
>bool QAbstractSocket::setSocketDescriptor ( int socketDescriptor,
>SocketState socketState = ConnectedState, OpenMode openMode = ReadWrite
> ) ---->>>It is not possible to initialize two abstract sockets with the
> same native socket descriptor.
>
>
>Is (B) possible ?

No. Your conclusion is correct.

-- 
 [ signature omitted ] 

Attachment: signature.asc
Description: This is a digitally signed message part.


Message 5 in thread

On Tuesday 11 December 2007 04:54:24 pm Yong Taro wrote:
> Basically what I'm interested in more is if I can create a QSslSocket
> out of a QTcpSocket.
> The idea is as follows:
> QTcpSocket* tcpSocket = QTcpServer::nextPendingConnection();
> (A) - QSslSocket sslSocket( tcpSocket );
> or
> (B) - QSslSocket sslSocket;
> (B) - sslSocket.setDescriptor( tcpSocket ->socketDescriptor() );
You might be able to switch in QCA::TLS with some really fancy footwork 
(changing around some of the signals/slots). I haven't tried this though.

QCA::TLS is a different concept to QSslSocket - it doesn't do any networking. 
Instead, you put it between your application code and your socket.

See http://delta.affinix.com/docs/qca/classQCA_1_1TLS.html (especially the 
examples that are linked off it) if you are interested.

Brad

--
 [ signature omitted ] 

Message 6 in thread

QCA looks very interesting, didn't knew abut this. thanks.

 
Brad Hards wrote:
> On Tuesday 11 December 2007 04:54:24 pm Yong Taro wrote:
>   
>> Basically what I'm interested in more is if I can create a QSslSocket
>> out of a QTcpSocket.
>> The idea is as follows:
>> QTcpSocket* tcpSocket = QTcpServer::nextPendingConnection();
>> (A) - QSslSocket sslSocket( tcpSocket );
>> or
>> (B) - QSslSocket sslSocket;
>> (B) - sslSocket.setDescriptor( tcpSocket ->socketDescriptor() );
>>     
> You might be able to switch in QCA::TLS with some really fancy footwork 
> (changing around some of the signals/slots). I haven't tried this though.
>
> QCA::TLS is a different concept to QSslSocket - it doesn't do any networking. 
> Instead, you put it between your application code and your socket.
>
> See http://delta.affinix.com/docs/qca/classQCA_1_1TLS.html (especially the 
> examples that are linked off it) if you are interested.
>
> Brad
>
>
>   

--
 [ signature omitted ]