[Interest] Pass socket descriptor to external library

Bob Hood bhood2 at comcast.net
Tue Oct 20 22:17:53 CEST 2015


I have an external library that implements a proprietary protocol with clients 
connected via a TCP socket.  I'm using Qt as the front end to deal with 
discovery (via Avahi) and connections (via QTcpServer).  For each incoming 
connection, I need to pass the raw socket descriptor returned by 
QTcpSocket::socketDescriptor() to the library interface for its exclusive use.

Are there any conflicts in doing this?

I don't see anything in the QTcpSocket interface to "take ownership" of the 
low-level socket, so will the QTcpSocket instance sit quietly while the 
library functions use the descriptor?

Can I safely connect the disconnected() signal to know when the library closes 
the socket?

Thanks for the assist.  :)




More information about the Interest mailing list