42 #ifndef QABSTRACTSOCKET_H
43 #define QABSTRACTSOCKET_H
47 #ifndef QT_NO_DEBUG_STREAM
58 #ifndef QT_NO_NETWORKPROXY
61 class QAbstractSocketPrivate;
72 UnknownSocketType = -1
77 UnknownNetworkLayerProtocol = -1
100 UnknownSocketError = -1
112 Idle = UnconnectedState,
113 HostLookup = HostLookupState,
114 Connecting = ConnectingState,
115 Connected = ConnectedState,
116 Closing = ClosingState,
117 Connection = ConnectedState
124 MulticastLoopbackOption
132 void connectToHost(
const QHostAddress &
address,
quint16 port, OpenMode
mode = ReadWrite);
133 void disconnectFromHost();
135 bool isValid()
const;
143 QHostAddress localAddress()
const;
145 QHostAddress peerAddress()
const;
149 qint64 readBufferSize()
const;
155 int socketDescriptor()
const;
156 bool setSocketDescriptor(
int socketDescriptor, SocketState state = ConnectedState,
157 OpenMode openMode = ReadWrite);
163 SocketType socketType()
const;
164 SocketState state()
const;
165 SocketError error()
const;
175 bool waitForConnected(
int msecs = 30000);
178 bool waitForDisconnected(
int msecs = 30000);
180 #ifndef QT_NO_NETWORKPROXY
191 #ifndef QT_NO_NETWORKPROXY
196 void connectToHostImplementation(
const QString &hostName,
quint16 port, OpenMode
mode = ReadWrite);
197 void disconnectFromHostImplementation();
204 void setSocketState(SocketState state);
205 void setSocketError(SocketError socketError);
206 void setLocalPort(
quint16 port);
207 void setLocalAddress(
const QHostAddress &
address);
208 void setPeerPort(
quint16 port);
209 void setPeerAddress(
const QHostAddress &
address);
227 ErrConnectionRefused = ConnectionRefusedError,
228 ErrHostNotFound = HostNotFoundError,
229 ErrSocketRead = UnknownSocketError
231 inline QT3_SUPPORT
int socket()
const {
return socketDescriptor(); }
232 inline QT3_SUPPORT
void setSocket(
int socket) { setSocketDescriptor(socket); }
233 inline QT3_SUPPORT
qulonglong waitForMore(
int msecs,
bool *timeout = 0)
const
238 if (error() == SocketTimeoutError && timeout)
242 typedef SocketState
State;
244 QT_MOC_COMPAT
void connectionClosed();
245 QT_MOC_COMPAT
void delayedCloseFinished();
251 #ifndef QT_NO_DEBUG_STREAM
260 #endif // QABSTRACTSOCKET_H
State
The state the media producing object is in at the moment.
virtual bool isSequential() const
virtual qint64 readLineData(char *data, qint64 maxlen)
#define Q_PRIVATE_SLOT(d, signature)
virtual qint64 writeData(const char *data, qint64 len)=0
virtual qint64 bytesToWrite() const
virtual qint64 readData(char *data, qint64 maxlen)=0
bool waitForReadyRead(int msecs=30000)
virtual bool canReadLine() const
#define QT_BEGIN_NAMESPACE
GLsizei GLsizei GLenum GLenum const GLvoid * data
virtual bool waitForReadyRead(int msecs)
GLsizei const GLfloat * value
GLuint const GLchar * name
virtual bool waitForBytesWritten(int msecs)
virtual qint64 bytesAvailable() const
Q_CORE_EXPORT QTextStream & flush(QTextStream &s)
virtual bool atEnd() const
Q_NETWORK_EXPORT QDebug operator<<(QDebug, QAbstractSocket::SocketError)