Based on the QT bittorrent client example