PDA

View Full Version : QtcpSocket and ports being used



youngw
30th October 2010, 10:07
Is there a way on Qt to look at the host and see which ports are being used and by whom?

Would tcpSocket->listen() or udpSocket->bind() give me the information.

squidge
30th October 2010, 13:05
You could parse the output of Netstat by using QProcess ?

Robbie
30th October 2010, 17:11
listen() and bind() are members of the relevant xServer classes and not the xSocket classes.

You can find out the local and foreign addresses and ports from QAbstractSocket::localHost(), QAbstractSocket::localPort(), QAbstractSocket::peerAddress() and QAbstractSocket::peerPort()