- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Signals | Public Member Functions | Protected Slots | Protected Member Functions

# QAbstractSocket Class Reference

Search for all occurrences

## Detailed Description

Definition at line 64 of file qabstractsocket.h.

`#include <qabstractsocket.h>`

Inheritance diagram for QAbstractSocket:
[legend]

List of all members.

## Public Types
enum | SocketType { TcpSocket, UdpSocket, UnknownSocketType = -1 }
enum | NetworkLayerProtocol { IPv4Protocol, IPv6Protocol, UnknownNetworkLayerProtocol = -1 }
enum | SocketError { ConnectionRefusedError, RemoteHostClosedError, HostNotFoundError, SocketAccessError, SocketResourceError, SocketTimeoutError, DatagramTooLargeError, NetworkError, AddressInUseError, SocketAddressNotAvailableError, UnsupportedSocketOperationError, UnfinishedSocketOperationError, ProxyAuthenticationRequiredError, SslHandshakeFailedError, ProxyConnectionRefusedError, ProxyConnectionClosedError, ProxyConnectionTimeoutError, ProxyNotFoundError, ProxyProtocolError, UnknownSocketError = -1 }
enum | SocketState { UnconnectedState, HostLookupState, ConnectingState, ConnectedState, BoundState, ListeningState, ClosingState }
enum | SocketOption { LowDelayOption, KeepAliveOption }
## Signals
void | hostFound ()
void | connected ()
void | disconnected ()
void | stateChanged (QAbstractSocket::SocketState)
void | error (QAbstractSocket::SocketError)
void | proxyAuthenticationRequired (const QNetworkProxy &proxy, QAuthenticator *authenticator)
## Public Member Functions
| QAbstractSocket (SocketType socketType, QObject *parent)
virtual | ~QAbstractSocket ()
void | connectToHost (const QString &hostName, quint16 port, OpenMode mode=ReadWrite)
void | connectToHost (const QHostAddress &address, quint16 port, OpenMode mode=ReadWrite)
void | disconnectFromHost ()
bool | isValid () const
qint64 | bytesAvailable () const
qint64 | bytesToWrite () const
bool | canReadLine () const
quint16 | localPort () const
QHostAddress | localAddress () const
quint16 | peerPort () const
QHostAddress | peerAddress () const
QString | peerName () const
qint64 | readBufferSize () const
void | setReadBufferSize (qint64 size)
void | abort ()
int | socketDescriptor () const
bool | setSocketDescriptor (int socketDescriptor, SocketState state=ConnectedState, OpenMode openMode=ReadWrite)
void | setSocketOption (QAbstractSocket::SocketOption option, const QVariant &value)
QVariant | socketOption (QAbstractSocket::SocketOption option)
SocketType | socketType () const
SocketState | state () const
SocketError | error () const
void | close ()
bool | isSequential () const
bool | atEnd () const
bool | flush ()
bool | waitForConnected (int msecs=30000)
bool | waitForReadyRead (int msecs=30000)
bool | waitForBytesWritten (int msecs=30000)
bool | waitForDisconnected (int msecs=30000)
void | setProxy (const QNetworkProxy &networkProxy)
QNetworkProxy | proxy () const
## Protected Slots
void | connectToHostImplementation (const QString &hostName, quint16 port, OpenMode mode=ReadWrite)
void | disconnectFromHostImplementation ()
## Protected Member Functions
qint64 | readData (char *data, qint64 maxlen)
qint64 | readLineData (char *data, qint64 maxlen)
qint64 | writeData (const char *data, qint64 len)
void | setSocketState (SocketState state)
void | setSocketError (SocketError socketError)
void | setLocalPort (quint16 port)
void | setLocalAddress (const QHostAddress &address)
void | setPeerPort (quint16 port)
void | setPeerAddress (const QHostAddress &address)
void | setPeerName (const QString &name)
| QAbstractSocket (SocketType socketType, QAbstractSocketPrivate &dd, QObject *parent=0)

## Member Enumeration Documentation

enum SocketType

Search for all occurrences

Enumerator:

  TcpSocket | Search for all occurrences
  UdpSocket | Search for all occurrences
  UnknownSocketType | Search for all occurrences

Definition at line 68 of file qabstractsocket.h.

                        {
            TcpSocket,
            UdpSocket,
            UnknownSocketType = -1
        };

enum NetworkLayerProtocol

Search for all occurrences

Enumerator:

  IPv4Protocol | Search for all occurrences
  IPv6Protocol | Search for all occurrences
  UnknownNetworkLayerProtocol | Search for all occurrences

Definition at line 73 of file qabstractsocket.h.

                                  {
            IPv4Protocol,
            IPv6Protocol,
            UnknownNetworkLayerProtocol = -1
        };

enum SocketError

Search for all occurrences

Enumerator:

  ConnectionRefusedError | Search for all occurrences
  RemoteHostClosedError | Search for all occurrences
  HostNotFoundError | Search for all occurrences
  SocketAccessError | Search for all occurrences
  SocketResourceError | Search for all occurrences
  SocketTimeoutError | Search for all occurrences
  DatagramTooLargeError | Search for all occurrences
  NetworkError | Search for all occurrences
  AddressInUseError | Search for all occurrences
  SocketAddressNotAvailableError | Search for all occurrences
  UnsupportedSocketOperationError | Search for all occurrences
  UnfinishedSocketOperationError | Search for all occurrences
  ProxyAuthenticationRequiredError | Search for all occurrences
  SslHandshakeFailedError | Search for all occurrences
  ProxyConnectionRefusedError | Search for all occurrences
  ProxyConnectionClosedError | Search for all occurrences
  ProxyConnectionTimeoutError | Search for all occurrences
  ProxyNotFoundError | Search for all occurrences
  ProxyProtocolError | Search for all occurrences
  UnknownSocketError | Search for all occurrences

Definition at line 78 of file qabstractsocket.h.

                         {
            ConnectionRefusedError,
            RemoteHostClosedError,
            HostNotFoundError,
            SocketAccessError,
            SocketResourceError,
            SocketTimeoutError,                     /* 5 */
            DatagramTooLargeError,
            NetworkError,
            AddressInUseError,
            SocketAddressNotAvailableError,
            UnsupportedSocketOperationError,        /* 10 */
            UnfinishedSocketOperationError,
            ProxyAuthenticationRequiredError,
            SslHandshakeFailedError,
            ProxyConnectionRefusedError,
            ProxyConnectionClosedError,             /* 15 */
            ProxyConnectionTimeoutError,
            ProxyNotFoundError,
            ProxyProtocolError,

            UnknownSocketError = -1
        };

enum SocketState

Search for all occurrences

Enumerator:

  UnconnectedState | Search for all occurrences
  HostLookupState | Search for all occurrences
  ConnectingState | Search for all occurrences
  ConnectedState | Search for all occurrences
  BoundState | Search for all occurrences
  ListeningState | Search for all occurrences
  ClosingState | Search for all occurrences

Definition at line 101 of file qabstractsocket.h.

                         {
            UnconnectedState,
            HostLookupState,
            ConnectingState,
            ConnectedState,
            BoundState,
            ListeningState,
            ClosingState
    #ifdef QT3_SUPPORT
            ,
            Idle = UnconnectedState,
            HostLookup = HostLookupState,
            Connecting = ConnectingState,
            Connected = ConnectedState,
            Closing = ClosingState,
            Connection = ConnectedState
    #endif
        };

enum SocketOption

Search for all occurrences

Enumerator:

  LowDelayOption | Search for all occurrences
  KeepAliveOption | Search for all occurrences

Definition at line 119 of file qabstractsocket.h.

                          {
            LowDelayOption, // TCP_NODELAY
            KeepAliveOption // SO_KEEPALIVE
        };

## Constructor & Destructor Documentation

QAbstractSocket | ( | SocketType | socketType,
|  | QObject * | parent
| ) |  |

virtual ~QAbstractSocket | ( |  | ) | `[virtual]`

QAbstractSocket | ( | SocketType | socketType,
|  | QAbstractSocketPrivate & | dd,
|  | QObject * | parent = `0`
| ) |  | `[protected]`

## Member Function Documentation

void connectToHost | ( | const QString & | hostName,
|  | quint16 | port,
|  | OpenMode | mode = `ReadWrite`
| ) |  |

Search for all occurrences

void connectToHost | ( | const QHostAddress & | address,
|  | quint16 | port,
|  | OpenMode | mode = `ReadWrite`
| ) |  |

Search for all occurrences

void disconnectFromHost | ( |  | ) |

Search for all occurrences

bool isValid | ( |  | ) | const

Search for all occurrences

qint64 bytesAvailable | ( |  | ) | const `[virtual]`

Search for all occurrences

Reimplemented from QIODevice.

Reimplemented in QSslSocket.

qint64 bytesToWrite | ( |  | ) | const `[virtual]`

Search for all occurrences

Reimplemented from QIODevice.

Reimplemented in QSslSocket.

bool canReadLine | ( |  | ) | const `[virtual]`

Search for all occurrences

Reimplemented from QIODevice.

Reimplemented in QSslSocket.

quint16 localPort | ( |  | ) | const

Search for all occurrences

QHostAddress localAddress | ( |  | ) | const

Search for all occurrences

quint16 peerPort | ( |  | ) | const

Search for all occurrences

QHostAddress peerAddress | ( |  | ) | const

Search for all occurrences

QString peerName | ( |  | ) | const

Search for all occurrences

qint64 readBufferSize | ( |  | ) | const

Search for all occurrences

void setReadBufferSize | ( | qint64 | size | ) |

Search for all occurrences

Reimplemented in QSslSocket.

void abort | ( |  | ) |

Search for all occurrences

Reimplemented in QSslSocket.

int socketDescriptor | ( |  | ) | const

Search for all occurrences

bool setSocketDescriptor | ( | int | socketDescriptor,
|  | SocketState | state = `ConnectedState`,
|  | OpenMode | openMode = `ReadWrite`
| ) |  |

Search for all occurrences

Reimplemented in QSslSocket.

void setSocketOption | ( | QAbstractSocket::SocketOption | option,
|  | const QVariant & | value
| ) |  |

Search for all occurrences

Reimplemented in QSslSocket.

QVariant socketOption | ( | QAbstractSocket::SocketOption | option | ) |

Search for all occurrences

Reimplemented in QSslSocket.

SocketType socketType | ( |  | ) | const

Search for all occurrences

SocketState state | ( |  | ) | const

Search for all occurrences

SocketError error | ( |  | ) | const

Search for all occurrences

void close | ( |  | ) | `[virtual]`

Search for all occurrences

Reimplemented from QIODevice.

Reimplemented in QSslSocket.

bool isSequential | ( |  | ) | const `[virtual]`

Search for all occurrences

Reimplemented from QIODevice.

bool atEnd | ( |  | ) | const `[virtual]`

Search for all occurrences

Reimplemented from QIODevice.

Reimplemented in QSslSocket.

bool flush | ( |  | ) |

Search for all occurrences

Reimplemented in QSslSocket.

bool waitForConnected | ( | int | msecs = `30000` | ) |

Search for all occurrences

Reimplemented in QSslSocket.

bool waitForReadyRead | ( | int | msecs = `30000` | ) | `[virtual]`

Search for all occurrences

Reimplemented from QIODevice.

Reimplemented in QSslSocket.

bool waitForBytesWritten | ( | int | msecs = `30000` | ) | `[virtual]`

Search for all occurrences

Reimplemented from QIODevice.

Reimplemented in QSslSocket.

bool waitForDisconnected | ( | int | msecs = `30000` | ) |

Search for all occurrences

Reimplemented in QSslSocket.

void setProxy | ( | const QNetworkProxy & | networkProxy | ) |

Search for all occurrences

QNetworkProxy proxy | ( |  | ) | const

Search for all occurrences

void hostFound | ( |  | ) | `[signal]`

Search for all occurrences

void connected | ( |  | ) | `[signal]`

Search for all occurrences

void disconnected | ( |  | ) | `[signal]`

Search for all occurrences

void stateChanged | ( | QAbstractSocket::SocketState |  | ) | `[signal]`

Search for all occurrences

void error | ( | QAbstractSocket::SocketError |  | ) | `[signal]`

Search for all occurrences

void proxyAuthenticationRequired | ( | const QNetworkProxy & | proxy,
|  | QAuthenticator * | authenticator
| ) |  | `[signal]`

Search for all occurrences

void connectToHostImplementation | ( | const QString & | hostName,
|  | quint16 | port,
|  | OpenMode | mode = `ReadWrite`
| ) |  | `[protected, slot]`

Search for all occurrences

Reimplemented in QSslSocket.

void disconnectFromHostImplementation | ( |  | ) | `[protected, slot]`

Search for all occurrences

Reimplemented in QSslSocket.

qint64 readData | ( | char * | data,
|  | qint64 | maxlen
| ) |  | `[protected, virtual]`

Search for all occurrences

Implements QIODevice.

Reimplemented in QSslSocket.

qint64 readLineData | ( | char * | data,
|  | qint64 | maxlen
| ) |  | `[protected, virtual]`

Search for all occurrences

Reimplemented from QIODevice.

qint64 writeData | ( | const char * | data,
|  | qint64 | len
| ) |  | `[protected, virtual]`

Search for all occurrences

Implements QIODevice.

Reimplemented in QSslSocket.

void setSocketState | ( | SocketState | state | ) | `[protected]`

Search for all occurrences

void setSocketError | ( | SocketError | socketError | ) | `[protected]`

Search for all occurrences

void setLocalPort | ( | quint16 | port | ) | `[protected]`

Search for all occurrences

void setLocalAddress | ( | const QHostAddress & | address | ) | `[protected]`

Search for all occurrences

void setPeerPort | ( | quint16 | port | ) | `[protected]`

Search for all occurrences

void setPeerAddress | ( | const QHostAddress & | address | ) | `[protected]`

Search for all occurrences

void setPeerName | ( | const QString & | name | ) | `[protected]`

Search for all occurrences

The documentation for this class was generated from the following file:

- QtNetwork/qabstractsocket.h

QAbstractSocket QAbstractSocket QAbstractSocket QAbstractSocket QAbstractSocket QAbstractSocket QAbstractSocket QAbstractSocket QAbstractSocket QAbstractSocket
QAbstractSocket QAbstractSocket QAbstractSocket QAbstractSocket QAbstractSocket QAbstractSocket QAbstractSocket QAbstractSocket QAbstractSocket QAbstractSocket