QNetworkProxyQuery Class Reference |
Query type | Description |
---|---|
TcpSocket | Normal sockets requesting a connection to a remote server, like QTcpSocket. The peer hostname and peer port match the values passed to QTcpSocket::connectToHost(). The local port is usually -1, indicating the socket has no preference in which port should be used. The URL component is not used. |
UdpSocket | Datagram-based sockets, which can both send and receive. The local port, remote host or remote port fields can all be used or be left unused, depending on the characteristics of the socket. The URL component is not used. |
TcpServer | Passive server sockets that listen on a port and await incoming connections from the network. Normally, only the local port is used, but the remote address could be used in specific circumstances, for example to indicate which remote host a connection is expected from. The URL component is not used. |
UrlRequest | A more high-level request, such as those coming from QNetworkAccessManager. These requests will inevitably use an outgoing TCP socket, but the this query type is provided to indicate that more detailed information is present in the URL component. For ease of implementation, the URL's host and port are set as the destination address. |
It should be noted that any of the criteria may be missing or unknown (an empty QString for the hostname or protocol name, -1 for the port numbers). If that happens, the functions executing the query should make their best guess or apply some implementation-defined default values.
See also QNetworkProxy, QNetworkProxyFactory, QNetworkAccessManager, and QAbstractSocket::setProxy().
Describes the type of one QNetworkProxyQuery query.
Constant | Value | Description |
---|---|---|
QNetworkProxyQuery::TcpSocket | 0 | a normal, outgoing TCP socket |
QNetworkProxyQuery::UdpSocket | 1 | a datagram-based UDP socket, which could send to multiple destinations |
QNetworkProxyQuery::TcpServer | 100 | a TCP server that listens for incoming connections from the network |
QNetworkProxyQuery::UrlRequest | 101 | a more complex request which involves loading of a URL |
See also queryType() and setQueryType().
Constructs a default QNetworkProxyQuery object. By default, the query type will be QNetworkProxyQuery::TcpSocket.
Constructs a QNetworkProxyQuery with the URL requestUrl and sets the query type to queryType.
See also protocolTag(), peerHostName(), and peerPort().
Constructs a QNetworkProxyQuery of type queryType and sets the protocol tag to be protocolTag. This constructor is suitable for QNetworkProxyQuery::TcpSocket queries, because it sets the peer hostname to hostname and the peer's port number to port.
Constructs a QNetworkProxyQuery of type queryType and sets the protocol tag to be protocolTag. This constructor is suitable for QNetworkProxyQuery::TcpSocket queries because it sets the local port number to bindPort.
Note that bindPort is of type quint16 to indicate the exact port number that is requested. The value of -1 (unknown) is not allowed in this context.
See also localPort().
Constructs a QNetworkProxyQuery object that is a copy of other.
Destroys this QNetworkProxyQuery object.
Returns the port number of the socket that will accept incoming packets from remote servers or -1 if the port is not known.
See also peerPort(), peerHostName(), and setLocalPort().
Returns the host name or IP address being of the outgoing connection being requested, or an empty string if the remote hostname is not known.
If the query type is QNetworkProxyQuery::UrlRequest, this function returns the host component of the URL being requested.
See also peerPort(), localPort(), and setPeerHostName().
Returns the port number for the outgoing request or -1 if the port number is not known.
If the query type is QNetworkProxyQuery::UrlRequest, this function returns the port number of the URL being requested. In general, frameworks will fill in the port number from their default values.
See also peerHostName(), localPort(), and setPeerPort().
Returns the protocol tag for this QNetworkProxyQuery object, or an empty QString in case the protocol tag is unknown.
In the case of queries of type QNetworkProxyQuery::UrlRequest, this function returns the value of the scheme component of the URL.
See also setProtocolTag() and url().
Returns the query type.
See also setQueryType().
Sets the port number that the socket wishes to use locally to accept incoming packets from remote servers to port. The local port is most often used with the QNetworkProxyQuery::TcpServer and QNetworkProxyQuery::UdpSocket query types.
Valid values are 0 to 65535 (with 0 indicating that any port number will be acceptable) or -1, which means the local port number is unknown or not applicable.
In some circumstances, for special protocols, it's the local port number can also be used with a query of type QNetworkProxyQuery::TcpSocket. When that happens, the socket is indicating it wishes to use the port number port when connecting to a remote host.
See also localPort(), setPeerPort(), and setPeerHostName().
Sets the hostname of the outgoing connection being requested to hostname. An empty hostname can be used to indicate that the remote host is unknown.
The peer host name can also be used to indicate the expected source address of an incoming connection in the case of QNetworkProxyQuery::UdpSocket or QNetworkProxyQuery::TcpServer query types.
See also peerHostName(), setPeerPort(), and setLocalPort().
Sets the requested port number for the outgoing connection to be port. Valid values are 1 to 65535, or -1 to indicate that the remote port number is unknown.
The peer port number can also be used to indicate the expected port number of an incoming connection in the case of QNetworkProxyQuery::UdpSocket or QNetworkProxyQuery::TcpServer query types.
See also peerPort(), setPeerHostName(), and setLocalPort().
Sets the protocol tag for this QNetworkProxyQuery object to be protocolTag.
The protocol tag is an arbitrary string that indicates which protocol is being talked over the socket, such as "http", "xmpp", "telnet", etc. The protocol tag is used by the backend to return a request that is more specific to the protocol in question: for example, a HTTP connection could be use a caching HTTP proxy server, while all other connections use a more powerful SOCKSv5 proxy server.
See also protocolTag().
Sets the query type of this object to be type.
See also queryType().
Sets the URL component of this QNetworkProxyQuery object to be url. Setting the URL will also set the protocol tag, the remote host name and port number. This is done so as to facilitate the implementation of the code that determines the proxy server to be used.
See also url(), peerHostName(), and peerPort().
Returns the URL component of this QNetworkProxyQuery object in case of a query of type QNetworkProxyQuery::UrlRequest.
See also setUrl().
Returns true if this QNetworkProxyQuery object does not contain the same data as other.
Copies the contents of other.
Returns true if this QNetworkProxyQuery object contains the same data as other.
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.5 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com