QT Qabstractsocket SocketError and some network programming uses the value of __ programming

Source: Internet
Author: User

Recently in a QT program to modify the code, basically the problem is to find out what the problem is the following is about the Qabstractsocket::socketerror value

And some other values, it's still useful.

1. Enum Qabstractsocket::networklayerprotocol

This enum describes the network layer protocol values used in Qt.

Constant Value Description
Qabstractsocket::ipv4protocol 0 IPv4
Qabstractsocket::ipv6protocol 1 IPv6
Qabstractsocket::unknownnetworklayerprotocol -1 Other than IPv4 and IPV6
Lists the network-level protocols used by QT, such as IP4,IP6. 2.enum Qiodevice::openmodeflag
Flags Qiodevice::openmode

This are used with open () to describe the "mode" which a device is opened. It is also returned by OpenMode ().

Constant Value Description
Qiodevice::notopen 0x0000 The device is not open.
Qiodevice::readonly 0x0001 The device is open for reading.
Qiodevice::writeonly 0x0002 The device is open for writing.
Qiodevice::readwrite ReadOnly | WriteOnly The device is open for reading and writing.
Qiodevice::append 0x0004 The device is opened into append mode, so this all data is written to the "end of" the file.
Qiodevice::truncate 0x0008 If possible, the device is truncated before it is opened. All earlier contents of the device are lost.
Qiodevice::text 0x0010 When reading, the End-of-line terminators are translated to ' \ n '. When writing, the End-of-line Terminators are translated to the "local encoding" for example ' \ r \ n ' for Win32.
Qiodevice::unbuffered 0x0020 Any buffer in the device is bypassed.

Lists the status of the open device. If the device is not open, open it as read-only and open it in writing.

3.enum Qabstractsocket::socketerror

This enum describes the socket errors that can occur.

Constant Value Description
Qabstractsocket::connectionrefusederror 0 The connection is refused by the peer (or timed out).
Qabstractsocket::remotehostclosederror 1 The remote host closed the connection. The client socket (i.e., this socket) is closed after the remote close notification has been sent.
Qabstractsocket::hostnotfounderror 2 The host address is not found.
Qabstractsocket::socketaccesserror 3 The socket operation failed because the application lacked the required privileges.
Qabstractsocket::socketresourceerror 4 The local system ran out of (e.g., too many sockets).
Qabstractsocket::sockettimeouterror 5 The socket operation timed out.
Qabstractsocket::D atagramtoolargeerror 6 The datagram was larger than the operating system ' s limit (which can is as low as 8192 bytes).
Qabstractsocket::networkerror 7 An error occurred with the network (e.g., the network cable is accidentally out).
Qabstractsocket::addressinuseerror 8 The address, specified to Qudpsocket::bind (), already in-use and being set to being exclusive.
Qabstractsocket::socketaddressnotavailableerror 9 The address specified to Qudpsocket::bind () does is not belong to the host.
Qabstractsocket::unsupportedsocketoperationerror 10 The requested socket operation isn't supported by the local operating system (e.g., lack of IPv6).
Qabstractsocket::P roxyauthenticationrequirederror 12 The socket is using a proxy, and the proxy requires authentication.
Qabstractsocket::sslhandshakefailederror 13 The Ssl/tls handshake failed, so the connection is closed (only used in Qsslsocket)
Qabstractsocket::unfinishedsocketoperationerror 11 Used by Qabstractsocketengine only, the last operation attempted has not finished yet (still in progress in the background ).
Qabstractsocket::P roxyconnectionrefusederror 14 Could not contacts the proxy server because the connection to that server is denied
Qabstractsocket::P roxyconnectionclosederror 15 The connection to the proxy server is closed unexpectedly (before the connection to the final peer is established)
Qabstractsocket::P roxyconnectiontimeouterror 16 The connection to the proxy server, timed out, or the proxy server stopped responding in the authentication phase.
Qabstractsocket::P roxynotfounderror 17 The proxy address set with SetProxy () (or the application proxy) is not found.
Qabstractsocket::P roxyprotocolerror 18 The connection negotiation with the proxy server because the response from the proxy server could is not understood.
Qabstractsocket::unknownsocketerror -1 An unidentified error occurred.

Lists errors that may occur in the connection, and error one by one is listed in the previous table.

4.enum qabstractsocket::socketstate

This enum describes the different states in which a socket can.

Constant Value Description
Qabstractsocket::unconnectedstate 0 The socket is not connected.
Qabstractsocket::hostlookupstate 1 The socket is performing a host name lookup.
Qabstractsocket::connectingstate 2 The socket has started establishing a connection.
Qabstractsocket::connectedstate 3 A Connection is established.
Qabstractsocket::boundstate 4 The socket is bound to a and port (for servers).
Qabstractsocket::closingstate 6 The ' socket is ' about to close ' (data may still being waiting to be written).
Qabstractsocket::listeningstate 5 For internal.

Lists the connection status of a socket

5.enum Qabstractsocket::sockettype

This enum describes the Transport layer protocol.

Constant Value Description
Qabstractsocket::tcpsocket 0 Tcp
Qabstractsocket::udpsocket 1 Udp
Qabstractsocket::unknownsockettype -1 Other than TCP and UDP

also Qabstractsocket::sockettype ().

Lists the ways in which sockets are connected.

The contents of the

table will be sorted later, thank you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.