Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Persian
  4. QTcpServer Error Setting proxy
Forum Updated to NodeBB v4.3 + New Features

QTcpServer Error Setting proxy

Scheduled Pinned Locked Moved Persian
6 Posts 3 Posters 4.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CuteKQ
    wrote on last edited by
    #1

    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);@
    
    1 Reply Last reply
    0
    • M Offline
      M Offline
      mohsen
      wrote on last edited by
      #2

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

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

      1 Reply Last reply
      0
      • C Offline
        C Offline
        CuteKQ
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mohsen
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • H Offline
            H Offline
            hasan_esfahan1
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • H Offline
              H Offline
              hasan_esfahan1
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved