QT QAbstractSocket类
来源:互联网 发布:php static class 编辑:程序博客网 时间:2024/05/16 04:34
QAbstractSocket is the base class for QTcpSocket and QUdpSocket and contains all common functionality of these two classes
是QTcpSocket and QUdpSocket的基类;
1.enum QAbstractSocket::SocketType:
QAbstractSocket::TcpSocket
QAbstractSocket::UdpSocket
QAbstractSocket::SctpSocket
QAbstractSocket::UnknownSocketType
2.void QAbstractSocket::abort()
立即断开当前套接字
3.bool QAbstractSocket::atEnd() const
Returns true if no more data is currently available for reading; otherwise returns false.
This function is most commonly used when reading data from the socket in a loop. For example:
void SocketClass::readyReadSlot() { while (!socket.atEnd()) { QByteArray data = socket.read(100); .... } }
4.bool QAbstractSocket::bind(const QHostAddress &address, quint16 port = 0, BindMode mode = DefaultForPlatform)
5.bool QAbstractSocket::bind(quint16 port = 0, BindMode mode = DefaultForPlatform)
6.qint64 QAbstractSocket::bytesAvailable() const
Returns the number of incoming bytes that are waiting to be read.
7.qint64 QAbstractSocket::bytesToWrite() const
Returns the number of bytes that are waiting to be written. The bytes are written when control goes back to the event loop or when flush() is called.
8.bool QAbstractSocket::canReadLine() const
Returns true if a line of data can be read from the socket; otherwise returns false.
9.void QAbstractSocket::close()
9.void QAbstractSocket::connectToHost(const QString &hostName, quint16 port, OpenMode openMode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol)
(1)hostName may be an IP address in string form (e.g., “43.195.83.32”), or it may be a host name (e.g., “example.com”).
10.void QAbstractSocket::connectToHost(const QHostAddress &address, quint16 port, OpenMode openMode = ReadWrite)
11.void QAbstractSocket::connected() signal
This signal is emitted after connectToHost() has been called and a connection has been successfully established.
12.void QAbstractSocket::disconnected()
This signal is emitted when the socket has been disconnected.
13.void QAbstractSocket::disconnectFromHost()
Attempts to close the socket and wait until all data has been written.
14.bool QAbstractSocket::flush()
15.bool QAbstractSocket::isValid() const
Returns true if the socket is valid and ready for use; otherwise returns false.
16.QHostAddress QAbstractSocket::localAddress() const
Returns the host address of the local socket if available; otherwise returns QHostAddress::Null.
17.quint16 QAbstractSocket::localPort() const
18.SocketType QAbstractSocket::socketType() const
Returns the socket type (TCP, UDP, or other).
19.bool QAbstractSocket::waitForConnected(int msecs = 30000)
Waits until the socket is connected, up to msecs milliseconds. If the connection has been established, this function returns true; otherwise it returns false
20.bool QAbstractSocket::waitForDisconnected(int msecs = 30000)
- QT QAbstractSocket类
- QT 网络模块QAbstractSocket类阅读
- qt之QAbstractSocket
- Qt 菜鸟的坑 QAbstractSocket::isValid()
- QT QAbstractSocket SocketError和 一些网络编程 用到的值
- QAbstractSocket::waitForDisconnected() is not allowed in UnconnectedState
- Qt类
- Qt 类简介之 Qt QApplication 类
- Qt 类简介之 Qt QApplication 类
- QT容器类-- Qt Container Classes(2)
- QT教程1:QT如何写类
- Qt入门:常用的Qt类
- Qt中的QFtp类
- 理解Qt多线程类
- QT主要类QWidget
- 理解Qt多线程类
- 理解Qt多线程类
- QT类继承图
- javamail方式发送邮件 直接上代码
- 1027. 打印沙漏(20)--Python
- BigDecimal加减乘除运算
- 网易云容器服务基于Kubernetes的实践探索
- 《Unity3D/2D游戏开发从0到1(第二版本)》 书稿完结总结
- QT QAbstractSocket类
- 模板函数,模板函数重载,显示具体化模板,实例化
- 2017年8月反思
- 洛谷2312:解方程(初等数论)
- myeclipse配置gradle插件
- git无法上传jar包问题
- learning R with swirl-sequences of numbers
- java新IO---文件锁
- 泪滴攻击