Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# Compatibility Members for QAbstractSocket

The following class members are part of the Qt 3 compatibility layer. They are provided to help you port old code to Qt 4. We strongly advise against using them in new code.

QAbstractSocket class reference

### Public Types

- enum Error { ErrConnectionRefused, ErrHostNotFound, ErrSocketRead }
- enum State { Idle, HostLookup, Connecting, Connected, Closing, Connection }

### Public Functions

- void setSocket ( int socket )
- int socket () const
- State state () const
- Q_ULONG waitForMore ( int msecs, bool * timeout = 0 ) const

### Signals

- void connectionClosed ()
- void delayedCloseFinished ()

## Member Type Documentation

### enum QAbstractSocket::Error

Use Qt::SocketError instead.

`QAbstractSocket::ErrConnectionRefused` | Use Qt::ConnectionRefusedError instead.
`QAbstractSocket::ErrHostNotFound` | Use Qt::HostNotFoundError instead.
`QAbstractSocket::ErrSocketRead` | Use Qt::UnknownSocketError instead.

### enum QAbstractSocket::State

Use Qt::SocketState instead.

`QAbstractSocket::Idle` | Use Qt::UnconnectedState instead.
`QAbstractSocket::HostLookup` | Use Qt::HostLookupState instead.
`QAbstractSocket::Connecting` | Use Qt::ConnectingState instead.
`QAbstractSocket::Connected` | Use Qt::ConnectedState instead.
`QAbstractSocket::Closing` | Use Qt::ClosingState instead.
`QAbstractSocket::Connection` | Use Qt::ConnectedState instead.

## Member Function Documentation

### void QAbstractSocket::connectionClosed () `[signal]`

Use closing() instead.

### void QAbstractSocket::delayedCloseFinished () `[signal]`

Use closed() instead.

### void QAbstractSocket::setSocket ( int socket )

Use setSocketDescriptor() instead.

### int QAbstractSocket::socket () const

Use socketDescriptor() instead.

### State QAbstractSocket::state () const

Use socketState() instead.

### Q_ULONG QAbstractSocket::waitForMore ( int msecs, bool * timeout = 0 ) const

Use waitForReadyRead() instead.

For example, if you have code like

        bool timeout;
        Q_ULONG numBytes = socket->waitForMore(30000, &timeout);

you can rewrite it as

        Q_LONGLONG numBytes = 0;
        if (socket->waitForReadyRead(msecs))
            numBytes = socket->bytesAvailable();
        bool timeout = (socketError() == Qt::SocketTimeoutError);

See also waitForReadyRead(), bytesAvailable(), socketError(), and Qt::SocketTimeoutError.