QTcpServer Error Setting proxy



  • Hi all, Im trying to set proxy for a QTcpSopcket, but suddenly when I call connectToHost()
    I face with this error :" QAbstractSocket::UnsupportedSocketOperationError , The requested socket operation is not supported by the local operating system (e.g., lack of IPv6 support). "

    where is the problem?

    here the code :

    @m_tcpSocket = new QTcpSocket();
    
    connect(m_tcpSocket,SIGNAL(connected()),this,SLOT(sltConnected()));
    connect(m_tcpSocket,SIGNAL(stateChanged(QAbstractSocket::SocketState)),
            this,SLOT(sltStateChanged(QAbstractSocket::SocketState)));
    connect(m_tcpSocket,SIGNAL(error(QAbstractSocket::SocketError)),
            this,SLOT(sltError(QAbstractSocket::SocketError)));
    
    p.setHostName("118.97.63.227");
    p.setPort(8080);
    p.setType(QNetworkProxy::HttpProxy);
    
    m_tcpSocket->setProxy(p);
    m_tcpSocket->connectToHost("www.google.com",80);@


  • p{direction:rtl;text-align:right;}. شما در کل نیازی به setType ندارید و توی tcp/ip معنی نداره اینکار. اگر نیاز به request و response از http دارید بجاش از QNetwrokAccessManager باید استفاده کنید.

    "QtExperts":http://www.qte.ir/?ref=dc91ce9f4f30603be23b9205c18199ff



  • na ma mikham bara socketam proxy set konam. Qhttp , QNetwrokAccessManager ina moshkeli nadaran.

    age type ro moshkhas nakoni ke khodesh type ro default mizare
    ke deafult ham applicationProxy hastesh.

    QNetworkProxy::DefaultProxy 0 Proxy is determined based on the application proxy set using setApplicationProxy()

    ke age setApplicationProxy() nakarde bashid typesh mishe NoProxy va kolan proxy tatil mishe.



  • p{direction:rtl;text-align:right;}. طبق مستندات

    p{direction:ltr;text-align:left;}. SOCKS 5    Generic proxy for any kind of connection. Supports TCP, UDP, binding to a port (incoming connections) and authentication.

    p{direction:ltr;text-align:left;}. HTTP    Implemented using the "CONNECT" command, supports only outgoing TCP connections; supports authentication.

    p{direction:ltr;text-align:left;}. Caching-only HTTP    Implemented using normal HTTP commands, it is useful only in the context of HTTP requests (see QNetworkAccessManager)

    p{direction:ltr;text-align:left;}. Caching FTP    Implemented using an FTP proxy, it is useful only in the context of FTP requests (see QNetworkAccessManager)

    "QtExperts":http://www.qte.ir/?ref=d987d5182df74338555f27fa847e3c3c



  • p{direction:rtl;text-align:right;}. QNetworkProxy proxy;
     proxy.setType(QNetworkProxy::Socks5Proxy); or proxy.setType(QNetworkProxy::HttpProxy);
     proxy.setHostName("proxy.example.com");
     proxy.setPort(1080);

    p{direction:rtl;text-align:right;}.  QNetworkProxy::setApplicationProxy(proxy);

    "QtExperts":http://www.qte.ir/?ref=5f8c6ce4dcc90c3971ac2689e48b1f89



  • p{direction:rtl;text-align:right;}. اقا من یه سوال داشت سر سوکت برای چی میخوای پروکسی ست کنی؟

    p{direction:rtl;text-align:right;}. اگه میخواهی وب را بفرستی رو پروکسی که باید از httpproxy استفاده کنی .

    p{direction:rtl;text-align:right;}. اگر هم میخواهی  پروکسی سرور کلاینت راه بندازی که این روشش نیست.

    p{direction:rtl;text-align:right;}.

    "QtExperts":http://www.qte.ir/?ref=bd5afd155dc35d35cd87640959a3b4b5


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.