Hello. I'm trying to use QUdpSocket with Socks5 proxy, but it doesn't work, when I connect, there are always errors. I do this: In main:

QNetworkProxy proxy; proxy.setType(QNetworkProxy::Socks5Proxy); proxy.setHostName("37.59.13.53"); proxy.setPort(45912); QNetworkProxy::setApplicationProxy(proxy); 

In the socket class constructor:

 sampSocket = new QUdpSocket(this); bool is = socket->bind(QHostAddress::LocalHost);//ΠŸΡ€ΠΎΠ±ΠΎΠ²Π°Π» всС Π²ΠΎΠ·ΠΌΠΎΠΆΠ½Ρ‹Π΅ Π²Π°Ρ€ΠΈΠ°Ρ†ΠΈΠΈ, ΠΈΡ‚ΠΎΠ³ ΠΎΠ΄ΠΈΠ½. 

Program screenshot

Sometimes gives an error

"Connection to proxy closed prematurely"

All proxies are working, checked by a web checker and used them in a telegram. Please tell me what I'm doing wrong.

UPD The problem seems to be in the proxies themselves. But to find proxies that work with UDP is almost unreal ....

    1 answer 1

    http://doc.qt.io/qt-5/qabstractsocket.html#setProxy

    and if so:

     QNetworkProxy proxy; proxy.setType(QNetworkProxy::Socks5Proxy); proxy.setHostName("ip address"); proxy.setPort(1080); udpSocket.setProxy(proxy); 
    • Tried it like that. As it turned out, the reason is bad proxies. Bought normal, but now a new error "Network operation timed out". Recommendations from the documentation used. - Logotipo
    • I tested my program on my local proxy / sox, to be sure that the problem is not in external proxies. Put any proxy server on localhost and use it. - vebmaster